File: tmath1.pp

package info (click to toggle)
fpc 2.6.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 178,760 kB
  • ctags: 83,946
  • sloc: pascal: 2,000,374; xml: 138,807; ansic: 9,617; asm: 7,843; yacc: 3,747; php: 3,271; sh: 2,626; makefile: 2,610; lex: 2,537; sql: 267; cpp: 145; sed: 132; perl: 126; csh: 34; tcl: 7
file content (74 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74



Procedure TestDiv;
var
 bx,by: byte;
 ix,iy: integer;
 wx,wy: word;
 lx,ly: longint;
Begin
 { byte test }
 bx:=10;
 by:=5;
 bx:=bx div by;
 if bx = 2 then
  WriteLn('TEST_DIV(1): PASSED.')
 else
  WriteLn('TEST_DIV(1): FAILED.');
 bx:=20;
 bx:=bx div 10;
 if bx = 2 then
  WriteLn('TEST_DIV(2): PASSED.')
 else
  WriteLn('TEST_DIV(2): FAILED.');
 { integer test }
 ix:=-10;
 iy:=5;
 ix:=ix div iy;
 if ix = -2 then
  WriteLn('TEST_DIV(3): PASSED.')
 else
  WriteLn('TEST_DIV(3): FAILED.');
 ix:=-20;
 ix:=ix div 10;
 if ix = -2 then
  WriteLn('TEST_DIV(4): PASSED.')
 else
  WriteLn('TEST_DIV(4): FAILED.');
 { word test }
 wx:=64000;
 wy:=2;
 wx:=wx div wy;
 if wx = 32000 then
  WriteLn('TEST_DIV(5): PASSED.')
 else
  WriteLn('TEST_DIV(5): FAILED.');
 wx:=20;
 wx:=wx div 10;
 if wx = 2 then
  WriteLn('TEST_DIV(6): PASSED.')
 else
  WriteLn('TEST_DIV(6): FAILED.');
 { longint test }
 lx:=-1000000;
 ly:=2;
 lx:=lx div ly;
 if lx = -500000 then
  WriteLn('TEST_DIV(7): PASSED.')
 else
  WriteLn('TEST_DIV(7): FAILED.');
 lx:=-1000000;
 lx:=lx div 10;
 if lx = -100000 then
  WriteLn('TEST_DIV(8): PASSED.')
 else
  WriteLn('TEST_DIV(8): FAILED.')
end;




Begin
 Testdiv;
end.