@@ -85,7 +85,31 @@ def test_DISP_can_be_overridden():
8585 # Note: DISP attribute won't exist if field not specified
8686 assert record .DISP .Value () == 0
8787
88+ def test_waveform_disallows_zero_length (clear_records ):
89+ """Test that WaveformIn/Out records throw an exception when being
90+ initialized with a zero length array"""
91+ with pytest .raises (AssertionError ):
92+ builder .WaveformIn ("W_IN" , [])
93+ with pytest .raises (AssertionError ):
94+ builder .WaveformOut ("W_OUT" , [])
95+
96+ def test_waveform_disallows_too_long_values (clear_records ):
97+ """Test that Waveform and longString records throw an exception when
98+ an overlong value is written"""
99+ w_in = builder .WaveformIn ("W_IN" , [1 , 2 , 3 ])
100+ w_out = builder .WaveformOut ("W_OUT" , [1 , 2 , 3 ])
101+
102+ ls_in = builder .longStringIn ("LS_IN" , initial_value = "ABC" )
103+ ls_out = builder .longStringOut ("LS_OUT" , initial_value = "ABC" )
88104
105+ with pytest .raises (AssertionError ):
106+ w_in .set ([1 , 2 , 3 , 4 ])
107+ with pytest .raises (AssertionError ):
108+ w_out .set ([1 , 2 , 3 , 4 ])
109+ with pytest .raises (AssertionError ):
110+ ls_in .set ("ABCD" )
111+ with pytest .raises (AssertionError ):
112+ ls_out .set ("ABCD" )
89113
90114def validate_fixture_names (params ):
91115 """Provide nice names for the out_records fixture in TestValidate class"""
0 commit comments