summaryrefslogtreecommitdiffstats
path: root/runtime/tests/string/string.test
blob: 348b6b1f894882c1e00a89d5f6d9283f18f2c91b (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package require tcltest
namespace import -force tcltest::*

cd $tcltest::testsDirectory

set CFLAGS "-Os"
set KPATH "/lib/modules/[exec uname -r]/build/include"
set MPATH "/lib/modules/[exec uname -r]/build/include/asm/mach-default"
set PATH "../../user"

test printf_A {Basic printf test} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test printf_A.c
} -body {
	exec ./test
} -result {ABCDE
12345678901234567890XYZZY
XYZZY
12345678901234567890
abcdefghij1234567890
abcdefghij1234567890X
12345
67890
abcde
1234567890abcdefghij
Q}

test printf_B {More printf test} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test printf_B.c
} -body {
	exec ./test
} -result {i=0 i=1 i=2 i=3 i=4 i=5 i=6 i=7 i=8 i=9 i=10 i=11 i=12 i=13 i=14 i=15 i=16 i=17 i=18 i=19 
[0  0  0] [1  1  1] [2  4  8] [3  9  27] [4  16  64] 
9223372036854775807 (7fffffffffffffff) -9223372036854775808(8000000000000000) }

test print_cstr {Test of _stp_print_cstr()} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test print_cstr.c
} -body {
	exec ./test
} -result {ABCDE
12345678901234567890XYZZY
XYZZY
12345678901234567890
abcdefghij1234567890
abcdefghij1234567890X
12345
67890
abcde
1234567890abcdefghij
Q}

test string1 {Basic String test} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test string1.c
} -body {
	exec ./test
} -result {Hello worldRed HatIntelIBM
Hello world / Red Hat / Intel / IBM / 
Red Hat Inc.
Hello world Red Hat 
IntelIBM}

test string2 {More String tests} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test string2.c
} -body {
	exec ./test
} -result {ABCDE
1234567890123456789
XYZZY
1234567890123
abcdefghij123456789
abcdefghij123456789
12345
67890
abcde
1234567890abcdefghi
Q}
test string3 {Even More String tests} -setup {
        exec gcc $CFLAGS -I $KPATH -I $PATH -I $MPATH -o test string3.c
} -body {
	exec ./test
} -result {1234567890abcABCDEvwxyz
abcde
1234567890abcde
1234567890abcdeABCD
1234567890abcdeABCD
ABCDEvwxyz}

exec rm test

cleanupTests