kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

test listed as fail ... though it works #561

Closed tavmem closed 4 years ago

tavmem commented 4 years ago

If I add the following test:

$ git diff
diff --git a/src/tests.c b/src/tests.c
index 840a2f3..6669bb5 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -306,6 +306,7 @@ Z I tests02()
   TC( 2, g:{a:x; {:[x=0; a:x; g(0)]}a; a}; g 2 )  // issue 549
   TC( 9, c:0; f:{c+:1;:[x;:[y;f[x-1;f[x;y-1]];f[x-1;1]];y+1]}; f[2;3] )    // Ackerman's function
   TC(  1,  (.((`a;1);(`b;2)))(`a) )               // issue 560
+  TC((,1), (.((`a;1);(`b;2)))(,`a) )              // issue 560

   //Error trap: {[a;b][c;d] a+b} -> parse error ; { {[a][b] }} -> parse error
   TC(.[*; (3;4); :], (0;12) )

It is listed as "failed", although the results match, and are correct:

$ ./k_tests
bash: ./k_tests: No such file or directory
$ ./k_test
t:0
t:50
t:100
t:150
t:200
t:250
t:300
t:350
t:400
t:450
t:500
t:550
t:600
t:650
t:700

Failed. These are not equal:
(,1) , (.((`a;1);(`b;2)))(,`a)
********************************
,1
--------------------------------
,1

t:750
t:800
t:850
t:900
t:950
t:1000
t:1050
t:1100
Test pass rate: 0.9991, Total: 1118, Passed: 1084, Skipped: 33, Failed: 1, Time: 0.359669s
fail
kona      \ for help. \\ to exit.
tavmem commented 4 years ago

Well ... this was a surprise:

$ rlwrap -n ./k
kona      \ for help. \\ to exit.

  a: (,1)
  b: (.((`a;1);(`b;2)))(,`a)
  a
,1
  b
,1
  a~b
0
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems 
\ for help. \\ to exit.

  a: (,1)
  b: (.((`a;1);(`b;2)))(,`a)
  a
,1
  b
,1
  a~b
1
tavmem commented 4 years ago

The reason:

kona      \ for help. \\ to exit.

  a: (,1)
  b: (.((`a;1);(`b;2)))(,`a)
  a
,1
  b
,1
  4: a
-1
  4: b
0
K 2.8 2000-10-10 Copyright (C) 1993-2000 Kx Systems 
\ for help. \\ to exit.

  a: (,1)
  b: (.((`a;1);(`b;2)))(,`a)
  a
,1
  b
,1
  4: a
-1
  4: b
-1