- Timestamp:
- Feb 3, 2025, 1:27:20 PM (8 months ago)
- Branches:
- master
- Children:
- dfe8f78
- Parents:
- 59fdd0d
- Location:
- tests
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/zero_one.txt
r59fdd0d r7959e56 3 3 It's a Number! 4 4 2 2 5 0 0 6 42 42 7 0 0 8 1 1 9 42 42 10 1 1 11 zero true 12 zero true 13 one false 14 one false -
tests/Makefile.am
r59fdd0d r7959e56 354 354 -cp ${test} ${abspath ${@}} 355 355 356 zero_one-ERR1 : zero_one.cfa ${CFACCBIN} 357 ${CFACOMPILE_SYNTAX} -DERR1 358 -cp ${test} ${abspath ${@}} 359 356 360 ctrl-flow/loop_else : ctrl-flow/loop_else.cfa ${CFACCBIN} 357 361 ${CC} ${AM_CFLAGS} -Wno-superfluous-else $< -o $@ -
tests/zero_one.cfa
r59fdd0d r7959e56 39 39 } 40 40 41 void testCompats() { 42 zero_t zero = 0; 43 one_t one = 1; 44 45 int x = 0; 46 int xx = zero; 47 48 sout | x | xx; 49 50 x = xx = 42; 51 sout | x | xx; 52 53 x = 0; 54 xx = zero; 55 sout | x | xx; 56 57 int y = 1; 58 int yy = one; 59 60 sout | y | yy; 61 62 y = yy = 42; 63 sout | y | yy; 64 65 y = 1; 66 yy = one; 67 sout | y | yy; 68 69 void z_helper( int * p, zero_t z ) { 70 p = z; // expect z not reported unused here; expect no missing cast from -Wint-conversion 71 sout | "zero" | (bool) (p == 0); 72 } 73 74 void z_call( int * p, zero_t z ) { 75 z_helper(p, z); 76 } 77 78 void o_helper( int * p, one_t o ) { 79 #ifdef ERR1 80 p = o; 81 #else 82 (void) x; (void) o; 83 #endif 84 sout | "one" | (bool) (p == 0); 85 } 86 87 void o_call( int * p, one_t o ) { 88 o_helper(p, o); 89 } 90 91 z_call( &x, 0 ); 92 z_call( &x, zero ); 93 94 o_call( &x, 1 ); 95 o_call( &x, one ); 96 } 97 41 98 int main() { 42 99 testOverloads(); 43 100 testInitAssignQueryIncrement(); 101 testCompats(); 44 102 return 0; 45 103 }
Note:
See TracChangeset
for help on using the changeset viewer.