#786 Added tests

master
Marius Kintel 2014-05-12 15:15:06 -04:00
parent c4e81baf65
commit 1cb754603b
2 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,16 @@ echo(str("Return up to 2 matches for string search; alternate columns (\"aebe\")
// s5= search("abe",sTable4,2,1,3); // bounds checking needs fixing.
// echo(str("Return up to 2 matches for string search; alternate columns: ",s4));
// Value searches
vTable1=[1,2,3];
v1 = search(3, vTable1);
echo(str("Default value search (3): ", v1));
vTable1=[1,2,3];
v2 = search(4, vTable1);
echo(str("Value not found (4): ", v2));
vTable2=[[0,1],[1,2],[2,3]];
v3 = search([[1,2]], vTable2);
echo(str("Value vector ([1,2]): ", v3));
// number searches
nTable1=[ [1,"a"],[3,"b"],[2,"c"],[4,"d"],[1,"a"],[7,"b"],[2,"c"],[8,"d"],[9,"e"],[10,"a"],[1,"a"] ];

View File

@ -10,6 +10,9 @@ ECHO: "Default string search (\"abe\"): [0, 1, 8]"
ECHO: "Return all matches for string search (\"abe\"): [[0, 4, 9, 10], [1, 5], [8]]"
ECHO: "Return up to 2 matches for string search (\"abe\"): [[0, 4], [1, 5], [8]]"
ECHO: "Return up to 2 matches for string search; alternate columns (\"aebe\"): [[0, 4], [8], [1, 5], [8]]"
ECHO: "Default value search (3): [2]"
ECHO: "Value not found (4): []"
ECHO: "Value vector ([1,2]): [1]"
ECHO: "Default number search (7): [5]"
ECHO: "Return all matches for number search (1): [0, 4, 10]"
ECHO: "Return up to 2 matches for number search (1): [0, 4]"