MCPcopy
hub / github.com/google/mangle / TestCases

Function TestCases

analysis/validation_test.go:80–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestCases(t *testing.T) {
81 entries, err := testCases.ReadDir("test_cases")
82 if err != nil {
83 t.Fatal(err)
84 }
85 for _, testCase := range entries {
86 t.Run(testCase.Name(), func(t *testing.T) {
87 file, err := testCases.ReadFile(
88 filepath.Join("test_cases", testCase.Name()))
89 if err != nil {
90 t.Fatal(err)
91 }
92 unit, err := parse.Unit(bytes.NewReader(file))
93 if err != nil {
94 t.Fatal(err)
95 }
96 _, err = AnalyzeAndCheckBounds([]parse.SourceUnit{unit}, nil, ErrorForBoundsMismatch)
97 if strings.HasPrefix(testCase.Name(), "neg") {
98 if err == nil { // NO error
99 t.Errorf("No error in test case %s, but we want an error", testCase.Name())
100 }
101 return
102 }
103 if err != nil {
104 t.Errorf("Unexpected error in test case %s: %s", testCase.Name(), err)
105 }
106 })
107 }
108}
109
110func TestCheckRulePositive(t *testing.T) {
111 tests := []ast.Clause{

Callers

nothing calls this directly

Calls 2

UnitFunction · 0.92
AnalyzeAndCheckBoundsFunction · 0.85

Tested by

no test coverage detected