(t *testing.T)
| 981 | } |
| 982 | } |
| 983 | func TestBoundOfArgTimeDuration(t *testing.T) { |
| 984 | // Setup a minimal analyzer/context if needed, or just test boundOfArg directly if possible. |
| 985 | // boundOfArg is private, so we need to test it via exported function or be in the same package. |
| 986 | // We are in 'analysis' package. |
| 987 | |
| 988 | // Helper to create a dummy name trie |
| 989 | nameTrie := symbols.NewNameTrie() |
| 990 | |
| 991 | tests := []struct { |
| 992 | name string |
| 993 | arg ast.BaseTerm |
| 994 | want ast.BaseTerm |
| 995 | }{ |
| 996 | { |
| 997 | name: "Time constant", |
| 998 | arg: ast.Time(123456789), |
| 999 | want: ast.TimeBound, |
| 1000 | }, |
| 1001 | { |
| 1002 | name: "Duration constant", |
| 1003 | arg: ast.Duration(1000), |
| 1004 | want: ast.DurationBound, |
| 1005 | }, |
| 1006 | { |
| 1007 | name: "Float64 constant", |
| 1008 | arg: ast.Float64(3.14), |
| 1009 | want: ast.Float64Bound, |
| 1010 | }, |
| 1011 | } |
| 1012 | |
| 1013 | for _, tt := range tests { |
| 1014 | t.Run(tt.name, func(t *testing.T) { |
| 1015 | got := boundOfArg(tt.arg, nil, nameTrie) |
| 1016 | if !got.Equals(tt.want) { |
| 1017 | t.Errorf("boundOfArg(%v) = %v, want %v", tt.arg, got, tt.want) |
| 1018 | } |
| 1019 | }) |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | func TestAnalyzeTemporal(t *testing.T) { |
| 1024 | program := ` |
nothing calls this directly
no test coverage detected