MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestModel_MissingContextFallbacks

Function TestModel_MissingContextFallbacks

common/cost/model_test.go:760–931  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

758}
759
760func TestModel_MissingContextFallbacks(t *testing.T) {
761 emptyCtx := &testEvalContext{}
762 emptyTrackCtx := &testTrackContext{}
763
764 tests := []struct {
765 name string
766 expr QuantityExpr
767 wantTrack uint64
768 checkEst func(t *testing.T, sz SizeEstimate)
769 }{
770 {
771 name: "missing_arg",
772 expr: Arg(5),
773 wantTrack: 0,
774 checkEst: func(t *testing.T, sz SizeEstimate) {
775 if sz != UnknownSizeEstimate() {
776 t.Errorf("got %v, want unknown", sz)
777 }
778 },
779 },
780 {
781 name: "missing_arg_elem",
782 expr: ArgElem(0),
783 wantTrack: 0,
784 checkEst: func(t *testing.T, sz SizeEstimate) {
785 if sz != UnknownSizeEstimate() {
786 t.Errorf("got %v, want unknown", sz)
787 }
788 },
789 },
790 {
791 name: "missing_arg_key",
792 expr: ArgKey(0),
793 // An absent value has no keys to measure. Before the projections were value-backed
794 // this reported a single byte per key regardless of the value.
795 wantTrack: 0,
796 checkEst: func(t *testing.T, sz SizeEstimate) {
797 if sz != UnknownSizeEstimate() {
798 t.Errorf("got %v, want unknown", sz)
799 }
800 },
801 },
802 {
803 name: "missing_target",
804 expr: Target(),
805 wantTrack: 0,
806 checkEst: func(t *testing.T, sz SizeEstimate) {
807 if sz != UnknownSizeEstimate() {
808 t.Errorf("got %v, want unknown", sz)
809 }
810 },
811 },
812 {
813 name: "missing_target_elem",
814 expr: TargetElem(),
815 wantTrack: 0,
816 checkEst: func(t *testing.T, sz SizeEstimate) {
817 if sz != UnknownSizeEstimate() {

Callers

nothing calls this directly

Calls 15

ArgFunction · 0.85
ArgElemFunction · 0.85
ArgKeyFunction · 0.85
TargetFunction · 0.85
TargetElemFunction · 0.85
TargetKeyFunction · 0.85
ElemOfFunction · 0.85
ConstFunction · 0.85
KeyOfFunction · 0.85
IntArgFunction · 0.85
IntTargetFunction · 0.85
ResultFunction · 0.85

Tested by

no test coverage detected