@@ -91,3 +91,30 @@ def assert_tendencies_correct(tendencies):
9191 assert tendencies [6 ].duration == approx (2 )
9292 assert tendencies [6 ].from_ == approx (8 )
9393 assert tendencies [6 ].to == approx (0 )
94+
95+
96+ def test_scientific_notation ():
97+ """Test if scientific notation is parsed correctly."""
98+ waveforms = {
99+ "waveform:\n - {type: linear, to: 1.5e5}" : 1.5e5 ,
100+ "waveform:\n - {type: linear, to: 1.5e+5}" : 1.5e5 ,
101+ "waveform:\n - {type: linear, to: 1.5E+5}" : 1.5e5 ,
102+ "waveform:\n - {type: linear, to: 1.5e-5}" : 1.5e-5 ,
103+ "waveform:\n - {type: linear, to: 1.5E-5}" : 1.5e-5 ,
104+ "waveform:\n - {type: linear, to: 1e5}" : 1e5 ,
105+ "waveform:\n - {type: linear, to: 1e+5}" : 1e5 ,
106+ "waveform:\n - {type: linear, to: 1E+5}" : 1e5 ,
107+ "waveform:\n - {type: linear, to: 1e-5}" : 1e-5 ,
108+ "waveform:\n - {type: linear, to: 1E-5}" : 1e-5 ,
109+ "waveform:\n - {type: linear, to: 0e5}" : 0.0 ,
110+ "waveform:\n - {type: linear, to: 0E0}" : 0.0 ,
111+ "waveform:\n - {type: linear, to: -1.5e5}" : - 1.5e5 ,
112+ "waveform:\n - {type: linear, to: -1E+5}" : - 1e5 ,
113+ "waveform:\n - {type: linear, to: -1.5e-5}" : - 1.5e-5 ,
114+ }
115+
116+ yaml_parser = YamlParser ()
117+
118+ for waveform , expected_value in waveforms .items ():
119+ yaml_parser .parse_waveforms (waveform )
120+ assert yaml_parser .waveform .tendencies [0 ].to == expected_value
0 commit comments