Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program testSuite;
- uses
- uTests;
- begin
- runTests;
- end.
- //---------------------------
- unit uTests;
- uses
- c64_vic;
- var
- x,y : Byte;
- count : Word;
- //----------------------------
- function test1 : Boolean;
- var
- a,b : Word;
- begin
- a := 4;
- Result := (a < word(10));
- end;
- //----------------------------
- function test2 : Boolean;
- var
- a,b : Word;
- begin
- a := 5;
- Result := (a <= word(5));
- end;
- //----------------------------
- function test3 : Boolean;
- var
- a,b : Word;
- begin
- a := 5;
- Result := (a = word(5));
- end;
- //----------------------------
- function test4 : Boolean;
- var
- a,b : Word;
- begin
- a := 20;
- b := 19;
- Result := b < a;
- end;
- //----------------------------
- function test5 : Boolean;
- var
- a,b : Word;
- begin
- a := 20;
- b := 20;
- Result := a <= b;
- end;
- //----------------------------
- function test6 : Boolean;
- var
- a,b : Word;
- begin
- a := 30;
- b := 19;
- Result := a > b;
- end;
- //----------------------------
- function test7 : Boolean;
- var
- a,b : Word;
- begin
- a := 30;
- b := 30;
- Result := a >= b;
- end;
- //----------------------------
- const
- rString : String = 'ft';
- rColor : array of Byte = (cyan,green);
- procedure doTest(v : Byte);
- var
- r : Byte;
- ofs : Word;
- c : Byte;
- begin
- r := v and 1;
- ofs := y * 40;
- ofs := ofs + x;
- // draw test number
- c := 48+((count shr 8) and $0f);
- poke(1024 + 0 + ofs,c);
- c := 48+((count shr 4) and $0f);
- poke(1024 + 1 + ofs,c);
- c := 48+(count and $0f);
- poke(1024 + 2 + ofs,c);
- // draw test result
- poke(1024 + 4 + ofs,rString[r+1]);
- poke($d800 + 4 + ofs,rColor[r]);
- y := y + 1;
- if y = 24 then begin
- y := 0;
- x := x + 6;
- end;
- decimalModeOn;
- count := count + 1;
- decimalModeOff;
- end;
- procedure runTests;
- var
- i : Byte;
- begin
- vic_clearScreen(1024,32);
- vic_clearScreen($d800,white);
- vic_border := black;
- vic_bg_color0 := black;
- x := 0;
- y := 0;
- count := $0001;
- doTest(test1);
- doTest(test2);
- doTest(test3);
- doTest(test4);
- doTest(test5);
- doTest(test6);
- while true do;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement