Skip to content

Commit

Permalink
Add external test
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Oct 10, 2024
1 parent cb95198 commit c8bbfb5
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions manual_tests.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
print "triangle\n";
triangle(2,3,4) = true;
print "triangleR\n";
triangleR(2.1,3.2,7.8) = false;
print "cycle\n";
cycle(4,[1,2,3,4,5]) = [5,1,2,3,4];
print "mirror\n";
mirror([1,2,3,4]) = [1,2,3,4,4,3,2,1];
print "gtList\n";
gtList([1,2,3,4,5],2) = [3,4,5];
print "suffix\n";
suffix([3,4,5],[1,2,3,4,5]) = true;
print "get\n";
get([1,2,3,4,5],3) = 4;
print "subList\n";
subList([1,2,3,4,5],1,3) = [2,3,4];
print "reverse\n";
reverse([1,2,3,4]) = [4,3,2,1];
print "apply\n";
apply([1,2,3,4,5],(fn x => x + 2)) = [3,4,5,6,7];
print "collapse\n";
collapse([1,2,3,4],5,(op +)) = 15;
print "quicksort\n";
quicksort (op <=) [3,5,1,2,4] = [1,2,3,4,5];
print "bubblesort\n";
bubblesort (op >=) [1,1,4,2,3] = [4,3,2,1,1];
print "insertionSort\n";
insertionSort (op <=) [~4,1,8,9,0,~2] = [~4,~2,0,1,8,9];
print "substring\n";
substring "zon" "arizona" = true;
print "indexOf\n";
indexOf 3 [1,2,3,4,5] = 2;
print "dec2baseN\n";
dec2baseN 2 10 = "1010";
print "dropNth\n";
dropNth 2 [1,2,3,4,5] = [1,3,5];
print "flatten\n";
flatten [[],[1,2,3],[4,5,6],[],[8,9]] = [1,2,3,4,5,6,8,9];
print "condenseLists\n";
condenseLists (op +) 0 [[],[1,2,3,4],[5,6]] = [0,10,11];
print "remove\n";
remove (fn x => x mod 3 = 0) [1,2,3,4,5,6,7,8,9] = [1,2,4,5,7,8];
print "triplist\n";
triplist [1,2,3] = [1,1,1,2,2,2,3,3,3];
print "repeat\n";
repeat [1,2] 4 = [1,2,1,2,1,2,1,2];
print "filterApply\n";
filterApply [1,2,3,4,5] (fn x => x mod 2 = 0) (fn x => x + 1) = [1,3,3,5,5];
print "arithSeq\n";
arithSeq 0 5 4 = [0,5,15,20];
print "element\n";
element 5 [1,2,3,4,5,6,7,8] = true;
print "isSet\n";
isSet [1,2,3,4,5] = true;
print "union\n";
union ([1,2,3],[2,3,4,5]) = [1,2,3,4,5];
print "intersection\n";
intersection ([1,2,3],[2,3,4,5]) = [2,3];
print "difference\n";
difference ([1,2,3],[2,3,4,5]) = [1];
print "xor\n";
xor ([1,2,3],[2,3,4,5]) = [1,4,5];
val ps = powerset [0,1];
fun member (e,l) = foldl (fn (el,b) => e = el orelse b) false l;
member([],ps);
member([0],ps);
member([1],ps);
member([0,1],ps);
print "end\n";


0 comments on commit c8bbfb5

Please sign in to comment.