]> git.sven.stormbind.net Git - sven/vym.git/blob - test/vym-selftest.vys
New upstream version 2.9.22
[sven/vym.git] / test / vym-selftest.vys
1 // vym selftest script
2
3 vym.clearConsole();
4 m1 = vym.currentMap();
5
6 tests_total  = 0;
7 tests_passed = 0;
8 tests_failed = 0;
9
10 // Function to compare and log values
11 function expect(comment, v_real, v_expected) {
12         tests_total = tests_total +1;
13     if (v_real == v_expected) {
14         print ("PASS: " + comment);
15                 tests_passed = tests_passed +1;
16     } else {
17         print ("FAIL: '" + comment + "' - Expected " + v_expected + ", but got " + v_real);
18                 tests_failed = tests_failed +1;
19     }
20 }
21
22 // Summary
23 function summary()
24 {
25         print ("Tests total: " + tests_total);
26         print ("Tests passed: " + tests_passed);
27         print ("Tests failed: " + tests_failed);
28 }
29 center_0 = "mc:0";
30 center_1 = "mc:1";
31 main_a = "mc:0,bo:0";
32   branch_a = main_a + ",bo:0";
33   branch_b = main_a + ",bo:1";
34   branch_c = main_a + ",bo:2";
35 main_b = "mc:0,bo:1"
36
37 n_centers = 2
38
39
40 // Testing the test function
41 expect ("1 should equal 3", 1, 3);
42 expect ("2 should equal 2", 2, 2);
43
44
45 summary();