Skip to content

Commit 0de812d

Browse files
committed
Add a simple test for UNCHANGED_ and ZERO_
Currently, UNCHANGED_ is not always "correct", for example when an expression becomes zero due to Multiply 0;
1 parent e3a9254 commit 0de812d

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

check/features.frm

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,3 +1187,93 @@ else
11871187
assert runtime_error?('Could not create sort file: bad_path\xformxxx.sor')
11881188
end
11891189
*--#] TempSortDir_windows :
1190+
*--#[ ZeroUnchanged :
1191+
#-
1192+
1193+
#procedure exprinfo
1194+
#message Module `CMODULE_':
1195+
#do e = {`activeexprnames_'}
1196+
#if `ZERO_`e''
1197+
#message zero `e': `ZERO_`e''
1198+
#endif
1199+
#if `UNCHANGED_`e''
1200+
#message unchanged `e': `UNCHANGED_`e''
1201+
#endif
1202+
#enddo
1203+
#if `ZERO_'
1204+
#message All zero: `ZERO_'
1205+
#endif
1206+
#if `UNCHANGED_'
1207+
#message All unchanged: `UNCHANGED_'
1208+
#endif
1209+
#message
1210+
#endprocedure
1211+
1212+
1213+
Off stats;
1214+
1215+
Symbol x,y;
1216+
1217+
Local test1 = x;
1218+
Local test2 = y;
1219+
Local test3 = 1;
1220+
.sort:1;
1221+
1222+
#call exprinfo
1223+
Identify x = 0;
1224+
.sort:2;
1225+
1226+
#call exprinfo
1227+
Identify y = 0;
1228+
.sort:3;
1229+
1230+
#call exprinfo
1231+
.sort:4;
1232+
1233+
#call exprinfo
1234+
Multiply 0;
1235+
.sort:5;
1236+
1237+
#message Here, test3 is incorrectly flagged as unchanged:
1238+
#call exprinfo
1239+
Print;
1240+
.end
1241+
assert succeeded?
1242+
assert result("test1") =~ expr("0")
1243+
assert result("test2") =~ expr("0")
1244+
assert result("test3") =~ expr("0")
1245+
assert stdout =~ exact_pattern(<<'EOF')
1246+
~~~Module 2:
1247+
~~~
1248+
~~~Module 3:
1249+
~~~zero test1: 1
1250+
~~~unchanged test2: 1
1251+
~~~unchanged test3: 1
1252+
~~~
1253+
~~~Module 4:
1254+
~~~zero test1: 1
1255+
~~~unchanged test1: 1
1256+
~~~zero test2: 1
1257+
~~~unchanged test3: 1
1258+
~~~
1259+
~~~Module 5:
1260+
~~~zero test1: 1
1261+
~~~unchanged test1: 1
1262+
~~~zero test2: 1
1263+
~~~unchanged test2: 1
1264+
~~~unchanged test3: 1
1265+
~~~All unchanged: 1
1266+
~~~
1267+
~~~Here, test3 is incorrectly flagged as unchanged:
1268+
~~~Module 6:
1269+
~~~zero test1: 1
1270+
~~~unchanged test1: 1
1271+
~~~zero test2: 1
1272+
~~~unchanged test2: 1
1273+
~~~zero test3: 1
1274+
~~~unchanged test3: 1
1275+
~~~All zero: 1
1276+
~~~All unchanged: 1
1277+
~~~
1278+
EOF
1279+
*--#] ZeroUnchanged :

0 commit comments

Comments
 (0)