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

Function TestModel_TrackerEvalContextMethods

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

Source from the content-addressed store, hash-verified

980}
981
982func TestModel_TrackerEvalContextMethods(t *testing.T) {
983 tCtx := &trackerEvalContext{
984 strategy: defaultSizing,
985 isMember: true,
986 args: []ref.Val{
987 types.String("target_val"),
988 types.Int(100),
989 },
990 result: types.String("result_val"),
991 }
992
993 tests := []struct {
994 name string
995 check func(t *testing.T)
996 }{
997 {
998 name: "estimator_is_nil",
999 check: func(t *testing.T) {
1000 if tCtx.Estimator() != nil {
1001 t.Errorf("Estimator() should be nil")
1002 }
1003 },
1004 },
1005 {
1006 name: "target_size",
1007 check: func(t *testing.T) {
1008 if sz := tCtx.Target(); sz != 10 {
1009 t.Errorf("Target() = %d, want 10", sz)
1010 }
1011 },
1012 },
1013 {
1014 name: "arg_size",
1015 check: func(t *testing.T) {
1016 if sz := tCtx.Arg(0); sz != 1 {
1017 t.Errorf("Arg(0) = %d, want 1", sz)
1018 }
1019 },
1020 },
1021 {
1022 name: "arg_size_out_of_bounds",
1023 check: func(t *testing.T) {
1024 if sz := tCtx.Arg(5); sz != 0 {
1025 t.Errorf("Arg(5) = %d, want 0", sz)
1026 }
1027 },
1028 },
1029 {
1030 name: "result_size",
1031 check: func(t *testing.T) {
1032 if sz := tCtx.Result(); sz != 10 {
1033 t.Errorf("Result() = %d, want 10", sz)
1034 }
1035 },
1036 },
1037 {
1038 name: "target_type",
1039 check: func(t *testing.T) {

Callers

nothing calls this directly

Calls 11

EstimatorMethod · 0.95
TargetMethod · 0.95
ArgMethod · 0.95
ResultMethod · 0.95
TargetTypeMethod · 0.95
ArgTypeMethod · 0.95
TargetValueMethod · 0.95
ArgValueMethod · 0.95
SizeMethod · 0.95
StringTypeAlias · 0.92
IntTypeAlias · 0.92

Tested by

no test coverage detected