github.com/blueinnovationsgroup/can-go@v0.0.0-20230518195432-d0567cda0028/pkg/dbc/analysis/passes/signalbounds/analyzer_test.go (about) 1 package signalbounds 2 3 import ( 4 "testing" 5 "text/scanner" 6 7 "github.com/blueinnovationsgroup/can-go/pkg/dbc/analysis" 8 "github.com/blueinnovationsgroup/can-go/pkg/dbc/analysis/analysistest" 9 ) 10 11 func TestAnalyzer(t *testing.T) { 12 analysistest.Run(t, Analyzer(), []*analysistest.Case{ 13 { 14 Name: "ok", 15 Data: ` 16 BO_ 500 IO_DEBUG: 4 IO 17 SG_ IO_DEBUG_test_unsigned : 0|8@1+ (1,0) [0|0] "" DBG 18 SG_ IO_DEBUG_test_enum : 8|8@1+ (1,0) [0|0] "" DBG 19 SG_ IO_DEBUG_test_signed : 16|8@1- (1,0) [0|0] "" DBG 20 SG_ IO_DEBUG_test_float : 24|8@1+ (0.5,0) [0|0] "" DBG 21 `, 22 }, 23 24 { 25 Name: "start bit out of bounds", 26 Data: ` 27 BO_ 500 IO_DEBUG: 4 IO 28 SG_ IO_DEBUG_test_unsigned : 0|8@1+ (1,0) [0|0] "" DBG 29 SG_ IO_DEBUG_test_enum : 8|8@1+ (1,0) [0|0] "" DBG 30 SG_ IO_DEBUG_test_signed : 16|8@1- (1,0) [0|0] "" DBG 31 SG_ IO_DEBUG_test_float : 32|8@1+ (0.5,0) [0|0] "" DBG 32 `, 33 Diagnostics: []*analysis.Diagnostic{ 34 { 35 Pos: scanner.Position{Line: 5, Column: 2}, 36 Message: "start bit out of bounds", 37 }, 38 }, 39 }, 40 }) 41 }