Skip to content

Commit 48ea095

Browse files
committed
COMMON: added basic unit tests
1 parent 0f707c4 commit 48ea095

File tree

15 files changed

+182
-56
lines changed

15 files changed

+182
-56
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ deb:
6363
fakeroot dpkg-buildpackage
6464

6565
test:
66-
(cd $(SUBDIRS) && make test)
66+
(cd @TEST_DIR@ && make test)
6767

6868
release:
6969
(cd $(SUBDIRS) && make release)

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@ function buildAndroid() {
522522

523523
BUILD_SUBDIRS="src/platform/android"
524524
AC_SUBST(BUILD_SUBDIRS)
525+
526+
TEST_DIR="src/platform/android"
527+
AC_SUBST(TEST_DIR)
525528
}
526529

527530
function buildConsole() {
@@ -582,6 +585,8 @@ function buildConsole() {
582585
AC_CHECK_HEADER(readline/readline.h, [], [AC_MSG_ERROR("install libreadline-dev")])
583586
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -ldl -lpthread -lncurses -lreadline"
584587
BUILD_SUBDIRS="src/common src/platform/unix"
588+
TEST_DIR="src/platform/unix"
589+
AC_SUBST(TEST_DIR)
585590
fi
586591

587592
AC_SUBST(BUILD_SUBDIRS)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TEST: Arrays, unound, lbound
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
TEST REPEAT
2+
TEST WHILE
3+
TEST FOR
4+
TEST SUB
5+
DONE
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
* simple
2+
psa:1
3+
1
4+
psb:1
5+
-1
6+
7+
* array
8+
psa:[1,2,3]
9+
[1,2,3]
10+
psb:[1,2,3]
11+
[-1,2,3]
12+
13+
* nested array #1
14+
psa:[[2,3,4],2,3]
15+
[[2,3,4],2,3]
16+
psb:[[2,3,4],2,3]
17+
[[-1,3,4],2,3]
18+
19+
* nested array #2
20+
psa:[2,3,4]
21+
[2,3,4]
22+
psb:[2,3,4]
23+
[-1,3,4]
24+
3
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Generic
2+
0.6: ERROR (acceptable?) <> 0.6
3+
4+
Auto type convertion
5+
n=i+n = 2.2 = 2.2
6+
n=n+i = 2.2 = 2.2
7+
n=n+n = 2.2 = 2.2
8+
i=i+i = 2 = 2
9+
n=i+s = 2.2 = 2.2
10+
n=i+s = -.1 = -0.1
11+
n=n+s = 2.2 = 2.2
12+
n=s+i = 2 = 2
13+
n=s+n = 2.2 = 2.2
14+
s=i+s = 1a = 1a
15+
s=n+s = 1.1a = 1.1a
16+
s=s+i = a1 = a1
17+
s=s+n = a1.1 = a1.1
18+
s=s+s = 11 = 11
19+
20+
Compare
21+
s=s = 1 = 1
22+
s=i = 1 = 1
23+
s=n = 1 = 1
24+
i=s = 1 = 1
25+
n=s = 1 = 1
26+
n=n = 1 = 1
27+
n=i = 1 = 1
28+
i=n = 1 = 1
29+
i=i = 1 = 1
30+
i>i = 1 = 1
31+
i>=i = 1 = 1
32+
i<=i = 1 = 1
33+
i<>i = 1 = 1
34+
35+
Array
36+
37+
Nested arrays
38+
true
39+
true
40+
41+
Testing base-convertion...
42+
Scientific notation = 2E+.3 = 3.99052462993776 --- 2E-2 = 0.02 = 0.02
43+
Bob's bug = -30 = -30
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Normal IF - Ok
2+
Inline IF - Ok
3+
Ok
4+
Ok
5+
label 500 - Ok
6+
label 600 - Ok
7+
3 inline IFs
8+
True
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
MATRICES
2+
3+
[-6;2;-7] + [5;4;-6] = [-1;6;-13]
4+
[-6;2;-7] - [5;4;-6] = [-11;-2;-1]
5+
[-6;2;-7] * 0.5 = [-3;1;-3.5]
6+
A = [-6;2;-7], -A = [6;-2;7]
7+
8+
[-2;3] * [7,6,-3,5] = [-14,-12,6,-10;21,18,-9,15]
9+
10+
[2,4;-1,-2] * [-2,2,4;1,-1,-2] = [0,0,0;0,0,0]
11+
12+
[-3,0;2,-1] * [4,-2;3,5] = [-12,6;5,-9]
13+
14+
Solve this:
15+
5x - 2y + 3z = -2
16+
-2x + 7y + 5z = 7
17+
3x + 5y + 6z = 9
18+
19+
[x; y; z] = [2;3;-2]
20+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Module: Meta-A
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
10
2+
20
3+
30
4+
40

0 commit comments

Comments
 (0)