File: testsuite_radix_include.kbs

package info (click to toggle)
basic256 2.0.99.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,888 kB
  • sloc: cpp: 17,185; yacc: 4,025; lex: 1,466; java: 1,091; sh: 39; xml: 33; makefile: 20
file content (68 lines) | stat: -rw-r--r-- 2,299 bytes parent folder | download | duplicates (2)
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
# testsuite_radix_include section for BASIC256

# test number formats including
# 0b...
# 0o...
# 0x...
# integer
# and float
 
# Modification History
# date		programmer	description
# 20140530	j.m.reneau	split from main program
#				added octal and entry of numbers
#				using bases directly
# 20140813      j.m.reneau      fix to parsing of integers outside of integer range
# 20160330 	j.m.reneau	updated to signed long integer

currentsuite = "radix"

call s("255 -> 11111111 bin", tobinary(255), "11111111")
call n("11111111 bin -> 255", frombinary("11111111"), 255)
call s("255 -> ff hex", tohex(255), "ff")
call n("ff hex -> 255", fromhex("FF"), 255)
call s("8 -> 10 octal", tooctal(8), "10")
call n("377 octal -> 255", fromoctal("377"), 255)
call s("36 -> 10 (36)", toradix(36,36), "10")
call n("22 (36) -> 74", fromradix("22",36), 74)

call n("0b10101011", 0b10101011, 171)
call n("0xfade", 0xfade, 64222)
call n("0O7711", 0O7711, 4041)

call n("0xffffffff",0xffffffff,-1)
call n("0x80000000",0x80000000,-2147483648)
call n("0x7fffffff",0x7fffffff,2147483647)
call n("0o37777777777",0o37777777777,-1)
call n("0o20000000000",0o20000000000,-2147483648)
call n("0o17777777777",0o17777777777,2147483647)
call n("0b11111111111111111111111111111111",0b11111111111111111111111111111111,-1)
call n("0b10000000000000000000000000000000",0b10000000000000000000000000000000,-2147483648)
call n("0b01111111111111111111111111111111",0b01111111111111111111111111111111,2147483647)

# check integer to/or float arround the borders
call n("i/f0",4,40.0/10)
call n("i/f1",3,30.0/10)
call n("i/f2",2,20.0/10)
call n("i/f3",1,10.0/10)
call n("i/f4",0,00.0/10)
call n("i/f5",-1,-10.0/10)
call n("i/f6",-2,-20.0/10)
call n("i/f7",-3,-30.0/10)
call n("i/f8",-4,-40.0/10)
call n("i/f9",2147483645,21474836450.0/10)
call n("i/f10",2147483646,21474836460.0/10)
call n("i/f11",2147483647,21474836470.0/10)
call n("i/f12",2147483648,21474836480.0/10)
call n("i/f13",2147483649,21474836490.0/10)
call n("i/f14",2147483650,21474836500.0/10)
call n("i/f15",-2147483645,-21474836450.0/10)
call n("i/f16",-2147483646,-21474836460.0/10)
call n("i/f17",-2147483647,-21474836470.0/10)
call n("i/f18",-2147483648,-21474836480.0/10)
call n("i/f19",-2147483649,-21474836490.0/10)
call n("i/f20",-2147483650,-21474836500.0/10)