Merge tag 'v3.14.25' into backport/v3.14.24-ltsi-rc1+v3.14.25/snapshot-merge.wip
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / staging / ktap / test / table.kp
1 #!/usr/bin/env ktap
2
3 function failed() {
4         printf("failed\n");
5         exit(-1);
6 }
7
8 ### table testing ###
9 x = {}
10 x[1] = "1"
11 if (x[1] != "1") {
12         failed()
13 }
14
15 x[1] = 22222222222222222222222222222222222222222
16 if (x[1] != 22222222222222222222222222222222222222222) {
17         failed()
18 }
19
20 x[1] = "jovi"
21 if (x[1] != "jovi") {
22         failed()
23 }
24
25 x[11111111111111111111111111111111] = "jovi"
26 if (x[11111111111111111111111111111111] != "jovi") {
27         failed()
28 }
29
30 x["jovi"] = 1
31 if (x["jovi"] != 1) {
32         failed()
33 }
34
35 x["long string....................................."] = 1
36 if (x["long string....................................."] != 1) {
37         failed()
38 }
39
40 # issue: subx must declare firstly, otherwise kernel will oops
41 subx = {}
42 subx["test"] = "this is test"
43 x["test"] = subx
44 if (x["test"]["test"] != "this is test") {
45         failed()
46 }
47
48 tbl = {}
49 i = 1
50 while (i < 100000) {
51         tbl[i] = i
52         i = i + 1
53 }
54
55 i = 1
56 while (i < 100000) {
57         if (tbl[i] != i) {
58                 failed()
59         }
60         i = i + 1
61 }
62
63 #### table initization
64 days = {"Sunday", "Monday", "Tuesday", "Wednesday",
65         "Thursday", "Friday", "Saturday"}
66
67 if (days[2] != "Monday") {
68         failed()
69 }
70
71