Changeset d30804a
- Timestamp:
- Jul 20, 2021, 6:34:06 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 86fc350
- Parents:
- 5dc4c7e
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/rational.txt
r5dc4c7e rd30804a 1 1 constructor 2 3/1 4/1 0/1 0/1 1/1 3 1/2 5/7 4 2/3 -3/2 5 -2/3 3/2 6 logical 7 -2/1 -3/2 8 1 9 1 10 1 11 0 12 0 2 a : 3/1 b : 4/1 c : 0/1 d : 0/1 e : 1/1 3 a : 1/2 b : 5/7 4 a : 2/3 b : -3/2 5 a : -2/3 b : 3/2 6 7 comparison 8 a : -2/1 b : -3/2 9 a == 0 : 0 10 a == 1 : 0 11 a != 0 : 1 12 ! a : 0 13 a != b : 1 14 a < b : 1 15 a <= b : 1 16 a > b : 0 17 a >= b : 0 18 13 19 arithmetic 14 -2/1 -3/2 15 -7/2 16 -1/2 17 3/1 18 4/3 20 a : -2/1 b : -3/2 21 a + b : -7/2 22 a += b : -7/2 23 ++a : -5/2 24 a++ : -5/2 25 a : -3/2 26 a - b : 0/1 27 a -= b : 0/1 28 --a : -1/1 29 a-- : -1/1 30 a : -2/1 31 a * b : 3/1 32 a / b : 4/3 33 a \ 2 : 4/1 b \ 2 : 9/4 34 a \ -2 : 1/4 b \ -2 : 4/9 35 19 36 conversion 20 37 0.75 … … 24 41 1/7 25 42 355/113 26 decompose 43 27 44 more tests 28 45 -3/2 -
tests/rational.cfa
r5dc4c7e rd30804a 10 10 // Created On : Mon Mar 28 08:43:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 8 18:46:23 202013 // Update Count : 8612 // Last Modified On : Tue Jul 20 18:13:40 2021 13 // Update Count : 107 14 14 // 15 15 … … 26 26 sout | "constructor"; 27 27 RatInt a = { 3 }, b = { 4 }, c, d = 0, e = 1; 28 sout | a | b | c | d| e;28 sout | "a : " | a | "b : " | b | "c : " | c | "d : " | d | "e : " | e; 29 29 30 30 a = (RatInt){ 4, 8 }; 31 31 b = (RatInt){ 5, 7 }; 32 sout | a| b;32 sout | "a : " | a | "b : " | b; 33 33 a = (RatInt){ -2, -3 }; 34 34 b = (RatInt){ 3, -2 }; 35 sout | a| b;35 sout | "a : " | a | "b : " | b; 36 36 a = (RatInt){ -2, 3 }; 37 37 b = (RatInt){ 3, 2 }; 38 sout | a | b; 38 sout | "a : " | a | "b : " | b; 39 sout | nl; 39 40 40 sout | " logical";41 sout | "comparison"; 41 42 a = (RatInt){ -2 }; 42 43 b = (RatInt){ -3, 2 }; 43 sout | a | b; 44 // sout | a == 1; // FIX ME 45 sout | a != b; 46 sout | a < b; 47 sout | a <= b; 48 sout | a > b; 49 sout | a >= b; 44 sout | "a : " | a | "b : " | b; 45 sout | "a == 0 : " | a == (Rational(int)){0}; // FIX ME 46 sout | "a == 1 : " | a == (Rational(int)){1}; // FIX ME 47 sout | "a != 0 : " | a != 0; 48 sout | "! a : " | ! a; 49 sout | "a != b : " | a != b; 50 sout | "a < b : " | a < b; 51 sout | "a <= b : " | a <= b; 52 sout | "a > b : " | a > b; 53 sout | "a >= b : " | a >= b; 54 sout | nl; 50 55 51 56 sout | "arithmetic"; 52 sout | a | b; 53 sout | a + b; 54 sout | a - b; 55 sout | a * b; 56 sout | a / b; 57 // sout | a \ 2 | b \ 2; // FIX ME 58 // sout | a \ -2 | b \ -2; 57 sout | "a : " | a | "b : " | b; 58 sout | "a + b : " | a + b; 59 sout | "a += b : " | (a += b); 60 sout | "++a : " | ++a; 61 sout | "a++ : " | a++; 62 sout | "a : " | a; 63 sout | "a - b : " | a - b; 64 sout | "a -= b : " | (a -= b); 65 sout | "--a : " | --a; 66 sout | "a-- : " | a--; 67 sout | "a : " | a; 68 sout | "a * b : " | a * b; 69 sout | "a / b : " | a / b; 70 sout | "a \\ 2 : " | a \ 2u | "b \\ 2 : " | b \ 2u; 71 sout | "a \\ -2 : " | a \ -2 | "b \\ -2 : " | b \ -2; 72 sout | nl; 59 73 60 74 sout | "conversion"; … … 68 82 sout | narrow( 0.14285714285714, 16 ); 69 83 sout | narrow( 3.14159265358979, 256 ); 84 sout | nl; 70 85 71 sout | "decompose";72 int n, d;73 //[n, d] = a;74 //sout | a | n | d;86 // sout | "decompose"; 87 // int n, d; 88 // [n, d] = a; 89 // sout | a | n | d; 75 90 76 91 sout | "more tests";
Note: See TracChangeset
for help on using the changeset viewer.