2018-08-19 22:24:02 +00:00
|
|
|
/****************************************
|
|
|
|
* CONDS - Test Conditional Expressions *
|
|
|
|
****************************************/
|
|
|
|
|
|
|
|
//Specify System Header using -H option
|
|
|
|
|
|
|
|
char allok;
|
|
|
|
|
2019-11-20 06:08:09 +00:00
|
|
|
void passed() {putstr(" PASS");}
|
|
|
|
void passln() {passed(); newlin();}
|
|
|
|
void failed() {putstr(" FAIL"); allok = $00;}
|
|
|
|
void failln() {failed(); newlin();}
|
2018-08-19 22:24:02 +00:00
|
|
|
|
2019-11-20 06:08:09 +00:00
|
|
|
main:
|
2018-08-19 22:24:02 +00:00
|
|
|
|
2019-11-20 06:08:09 +00:00
|
|
|
allok = $FF; //TRUE
|
|
|
|
|
|
|
|
putstr("TEST CONDITIONALS"); newlin();
|
|
|
|
|
|
|
|
putstr(" 1<>1"); if (1<>1) failed(); else passed();
|
|
|
|
putstr(" 1<>2"); if (1<>2) passln(); else failln();
|
|
|
|
putstr(" 1==1"); if (1==1) passed(); else failed();
|
|
|
|
putstr(" 1==2"); if (1==2) failln(); else passln();
|
|
|
|
putstr("1+1=2"); if (1+1 == 2) passed(); else failed();
|
|
|
|
putstr(" 2<1"); if (2<1) failln(); else passln();
|
|
|
|
putstr(" 1<1"); if (1<1) failed(); else passed();
|
|
|
|
putstr(" 1<2"); if (1<2) passln(); else failln();
|
|
|
|
|
|
|
|
putstr(" 1<=1"); if (1<=1) passed(); else failed();
|
|
|
|
putstr(" 1<=2"); if (1<=2) passln(); else failln();
|
|
|
|
putstr(" 2<=1"); if (2<=1) failed(); else passed();
|
|
|
|
putstr(" 2>1"); if (2>1) passln(); else failln();
|
|
|
|
putstr(" 1>1"); if (1>1) failed(); else passed();
|
|
|
|
putstr(" 1>2"); if (1>2) failln(); else passln();
|
|
|
|
putstr(" 1>=1"); if (1>=1) passed(); else failed();
|
|
|
|
putstr(" 1>=2"); if (1>=2) failln(); else passln();
|
|
|
|
putstr(" 2>=1"); if (2>=1) passed(); else failed();
|
|
|
|
putstr(" !0:+"); if (!0:+) failln(); else passln();
|
|
|
|
|
|
|
|
putstr("$FF:+"); if ($FF:+) failed(); else passed();
|
|
|
|
putstr(" $FF"); if ($FF) passln(); else failln();
|
|
|
|
putstr("$FF:-"); if ($FF:-) passed(); else failed();
|
|
|
|
putstr(" !$FF"); if (!$FF) failln(); else passln();
|
|
|
|
putstr("$00:+"); if ($00:+) passed(); else failed();
|
|
|
|
putstr(" $00"); if ($00) failln(); else passln();
|
|
|
|
putstr("$00:-"); if ($00:-) failed(); else passed();
|
|
|
|
putstr(" !$00"); if (!$00) passln(); else failln();
|
|
|
|
|
|
|
|
putstr(" 1!0"); if (1|0) passed(); else failed();
|
|
|
|
putstr(" !1!0"); if (!1|0) failln(); else passln();
|
|
|
|
putstr(" 1&0"); if (1&0) failed(); else passed();
|
|
|
|
putstr(" !1&0"); if (!1&0) passln(); else failln();
|
|
|
|
putstr(" 1^1"); if (1^1) failed(); else passed();
|
|
|
|
putstr(" !1^1"); if (!1^1) passln(); else failln();
|
|
|
|
|
|
|
|
if (allok) putstr("ALL TESTS PASSED"); newlin();
|
|
|
|
getchr();
|
|
|
|
goto exit;
|
2018-08-19 22:24:02 +00:00
|
|
|
|