;; test-Exercise04-sigma.imp
(check-expect (sigma 0 0) 0)
(check-expect (sigma 0 5) 15)
(check-expect (sigma 0 10) 55)
(check-expect (sigma 5 5) 5)
(check-expect (sigma 5 10) 45)
(check-expect (sigma 5 15) 110)
(check-expect (sigma -5 0) -15)
(check-expect (sigma -10 0) -55)
(check-expect (sigma -5 -5) -5)
(check-expect (sigma -10 -5) -45)
(check-expect (sigma -15 -5) -110)
;; test-Exercise05a-exp.imp
(check-expect (exp 0 1) 0)
(check-expect (exp 0 5) 0)
(check-expect (exp 0 10) 0)
(check-expect (exp 2 0) 1)
(check-expect (exp 2 5) 32)
(check-expect (exp 2 10) 1024)
(check-expect (exp 2 15) 32768)
(check-expect (exp 5 0) 1)
(check-expect (exp 5 5) 3125)
(check-expect (exp 5 10) 9765625)
(check-expect (exp 5 15) 452807053)
;; test-Exercise05b-log.imp
(check-expect (log 2 1) 0)
(check-expect (log 2 2) 1)
(check-expect (log 2 3) 1)
(check-expect (log 2 4) 2)
(check-expect (log 2 5) 2)
(check-expect (log 2 6) 2)
(check-expect (log 2 7) 2)
(check-expect (log 2 8) 3)
(check-expect (log 2 9) 3)
(check-expect (log 2 10) 3)
(check-expect (log 2 127) 6)
(check-expect (log 2 128) 7)
(check-expect (log 2 129) 7)
(check-expect (log 2 1023) 9)
(check-expect (log 2 1024) 10)
(check-expect (log 2 1025) 10)
(check-expect (log 3 1) 0)
(check-expect (log 3 2) 0)
(check-expect (log 3 3) 1)
(check-expect (log 3 4) 1)
(check-expect (log 3 5) 1)
(check-expect (log 3 6) 1)
(check-expect (log 3 7) 1)
(check-expect (log 3 8) 1)
(check-expect (log 3 9) 2)
(check-expect (log 3 10) 2)
(check-expect (log 3 6560) 7)
(check-expect (log 3 6561) 8)
(check-expect (log 3 6562) 8)
(check-expect (log 3 59048) 9)
(check-expect (log 3 59049) 10)
(check-expect (log 3 59050) 10)
(check-expect (log 4 59050) 7)
(check-expect (log 5 59050) 6)
(check-expect (log 6 59050) 6)
(check-expect (log 7 59050) 5)
(check-expect (log 8 59050) 5)
(check-expect (log 9 59050) 5)
;; test-Exercise06-choose.imp
(check-expect (choose 0 0) 1)
(check-expect (choose 2 0) 1)
(check-expect (choose 2 1) 2)
(check-expect (choose 2 2) 1)
(check-expect (choose 10 0) 1)
(check-expect (choose 10 2) 45)
(check-expect (choose 10 4) 210)
(check-expect (choose 10 5) 252)
(check-expect (choose 10 6) 210)
(check-expect (choose 10 8) 45)
(check-expect (choose 10 10) 1)
(check-expect (choose 20 0) 1)
(check-expect (choose 20 4) 4845)
(check-expect (choose 20 9) 167960)
(check-expect (choose 20 10) 184756)
(check-expect (choose 20 11) 167960)
(check-expect (choose 20 16) 4845)
(check-expect (choose 20 20) 1)
;; test-Exercise07-fib.imp
(check-expect (fib 0) 0)
(check-expect (fib 1) 1)
(check-expect (fib 2) 1)
(check-expect (fib 3) 2)
(check-expect (fib 4) 3)
(check-expect (fib 5) 5)
(check-expect (fib 10) 55)
(check-expect (fib 15) 610)
(check-expect (fib 20) 6765)
(check-expect (fib 25) 75025)
;; test-Exercise08a-prime?.imp
(check-expect (prime? 2) 1)
(check-expect (prime? 3) 1)
(check-expect (prime? 4) 0)
(check-expect (prime? 5) 1)
(check-expect (prime? 6) 0)
(check-expect (prime? 7) 1)
(check-expect (prime? 8) 0)
(check-expect (prime? 9) 0)
(check-expect (prime? 10) 0)
(check-expect (prime? 11) 1)
(check-expect (prime? 12) 0)
(check-expect (prime? 13) 1)
(check-expect (prime? 14) 0)
(check-expect (prime? 1008) 0)
(check-expect (prime? 1009) 1)
(check-expect (prime? 1010) 0)
(check-expect (prime? 1011) 0)
(check-expect (prime? 1012) 0)
(check-expect (prime? 1013) 1)
(check-expect (prime? 1014) 0)
;; test-Exercise08b-nthprime.imp
(check-expect (nthprime 1) 2)
(check-expect (nthprime 2) 3)
(check-expect (nthprime 3) 5)
(check-expect (nthprime 4) 7)
(check-expect (nthprime 5) 11)
(check-expect (nthprime 6) 13)
(check-expect (nthprime 7) 17)
(check-expect (nthprime 8) 19)
(check-expect (nthprime 9) 23)
(check-expect (nthprime 10) 29)
(check-expect (nthprime 20) 71)
(check-expect (nthprime 30) 113)
(check-expect (nthprime 40) 173)
(check-expect (nthprime 50) 229)
(check-expect (nthprime 75) 379)
;; test-Exercise08c-sumprimes.imp
(check-expect (sumprimes 1) 2)
(check-expect (sumprimes 2) 5)
(check-expect (sumprimes 3) 10)
(check-expect (sumprimes 4) 17)
(check-expect (sumprimes 5) 28)
(check-expect (sumprimes 6) 41)
(check-expect (sumprimes 7) 58)
(check-expect (sumprimes 8) 77)
(check-expect (sumprimes 9) 100)
(check-expect (sumprimes 10) 129)
(check-expect (sumprimes 20) 639)
(check-expect (sumprimes 30) 1593)
(check-expect (sumprimes 40) 3087)
(check-expect (sumprimes 50) 5117)
;; test-Exercise08d-relprime?.imp
(check-expect (relprime? 2 2) 0)
(check-expect (relprime? 2 3) 1)
(check-expect (relprime? 2 4) 0)
(check-expect (relprime? 2 5) 1)
(check-expect (relprime? 2 6) 0)
(check-expect (relprime? 3 2) 1)
(check-expect (relprime? 3 3) 0)
(check-expect (relprime? 3 4) 1)
(check-expect (relprime? 3 5) 1)
(check-expect (relprime? 3 6) 0)
(check-expect (relprime? 4 2) 0)
(check-expect (relprime? 4 3) 1)
(check-expect (relprime? 4 4) 0)
(check-expect (relprime? 4 5) 1)
(check-expect (relprime? 4 6) 0)
(check-expect (relprime? 5 2) 1)
(check-expect (relprime? 5 3) 1)
(check-expect (relprime? 5 4) 1)
(check-expect (relprime? 5 5) 0)
(check-expect (relprime? 5 6) 1)
(check-expect (relprime? 6 2) 0)
(check-expect (relprime? 6 3) 0)
(check-expect (relprime? 6 4) 0)
(check-expect (relprime? 6 5) 1)
(check-expect (relprime? 6 6) 0)
(check-expect (relprime? 18 712) 0)
(check-expect (relprime? 514 793) 1)
(check-expect (relprime? 8 819) 1)
(check-expect (relprime? 813 286) 1)
(check-expect (relprime? 759 824) 1)
(check-expect (relprime? 863 133) 1)
(check-expect (relprime? 255 695) 0)
(check-expect (relprime? 254 726) 0)
(check-expect (relprime? 708 102) 0)
(check-expect (relprime? 781 87) 1)
(check-expect (relprime? 510 248) 0)
(check-expect (relprime? 445 220) 0)
(check-expect (relprime? 572 977) 1)
(check-expect (relprime? 983 736) 1)
(check-expect (relprime? 376 875) 1)
(check-expect (relprime? 901 876) 1)
(check-expect (relprime? 879 675) 0)
(check-expect (relprime? 302 377) 1)
(check-expect (relprime? 852 569) 1)
(check-expect (relprime? 726 408) 0)
(check-expect (relprime? 617 289) 1)
;; test-Exercise09-all-fours?.imp
(check-expect (all-fours? -5) 0)
(check-expect (all-fours? -4) 1)
(check-expect (all-fours? -3) 0)
(check-expect (all-fours? -2) 0)
(check-expect (all-fours? -1) 0)
(check-expect (all-fours? 0) 0)
(check-expect (all-fours? 1) 0)
(check-expect (all-fours? 2) 0)
(check-expect (all-fours? 3) 0)
(check-expect (all-fours? 4) 1)
(check-expect (all-fours? 5) 0)
(check-expect (all-fours? -15) 0)
(check-expect (all-fours? -14) 0)
(check-expect (all-fours? -13) 0)
(check-expect (all-fours? -12) 0)
(check-expect (all-fours? -11) 0)
(check-expect (all-fours? 10) 0)
(check-expect (all-fours? 11) 0)
(check-expect (all-fours? 12) 0)
(check-expect (all-fours? 13) 0)
(check-expect (all-fours? 14) 0)
(check-expect (all-fours? 15) 0)
(check-expect (all-fours? -45) 0)
(check-expect (all-fours? -44) 1)
(check-expect (all-fours? -43) 0)
(check-expect (all-fours? -42) 0)
(check-expect (all-fours? -41) 0)
(check-expect (all-fours? 40) 0)
(check-expect (all-fours? 41) 0)
(check-expect (all-fours? 42) 0)
(check-expect (all-fours? 43) 0)
(check-expect (all-fours? 44) 1)
(check-expect (all-fours? 45) 0)
(check-expect (all-fours? -444) 1)
(check-expect (all-fours? -443) 0)
(check-expect (all-fours? -4444) 1)
(check-expect (all-fours? -4443) 0)
(check-expect (all-fours? -44444) 1)
(check-expect (all-fours? -44443) 0)
(check-expect (all-fours? 444) 1)
(check-expect (all-fours? 443) 0)
(check-expect (all-fours? 4444) 1)
(check-expect (all-fours? 4443) 0)
(check-expect (all-fours? 44444) 1)
(check-expect (all-fours? 44443) 0)
;; test-Exercise09-all-one-digit?.imp
(check-expect (all-one-digit? 0) 1)
(check-expect (all-one-digit? -4) 1)
(check-expect (all-one-digit? 4) 1)
(check-expect (all-one-digit? -44444) 1)
(check-expect (all-one-digit? -44443) 0)
(check-expect (all-one-digit? -34) 0)
(check-expect (all-one-digit? 44444) 1)
(check-expect (all-one-digit? 44443) 0)
(check-expect (all-one-digit? 34) 0)
(check-expect (all-one-digit? 10) 0)
(check-expect (all-one-digit? 11) 1)
(check-expect (all-one-digit? 12) 0)
(check-expect (all-one-digit? -10) 0)
(check-expect (all-one-digit? -11) 1)
(check-expect (all-one-digit? -12) 0)
(check-expect (all-one-digit? 220) 0)
(check-expect (all-one-digit? 221) 0)
(check-expect (all-one-digit? 222) 1)
(check-expect (all-one-digit? -220) 0)
(check-expect (all-one-digit? -221) 0)
(check-expect (all-one-digit? -222) 1)
;; test-Exercise09-given-positive-all-fours?.imp
(check-expect (given-positive-all-fours? 1) 0)
(check-expect (given-positive-all-fours? 2) 0)
(check-expect (given-positive-all-fours? 3) 0)
(check-expect (given-positive-all-fours? 4) 1)
(check-expect (given-positive-all-fours? 5) 0)
(check-expect (given-positive-all-fours? 10) 0)
(check-expect (given-positive-all-fours? 11) 0)
(check-expect (given-positive-all-fours? 12) 0)
(check-expect (given-positive-all-fours? 13) 0)
(check-expect (given-positive-all-fours? 14) 0)
(check-expect (given-positive-all-fours? 15) 0)
(check-expect (given-positive-all-fours? 30) 0)
(check-expect (given-positive-all-fours? 31) 0)
(check-expect (given-positive-all-fours? 32) 0)
(check-expect (given-positive-all-fours? 33) 0)
(check-expect (given-positive-all-fours? 34) 0)
(check-expect (given-positive-all-fours? 35) 0)
(check-expect (given-positive-all-fours? 40) 0)
(check-expect (given-positive-all-fours? 41) 0)
(check-expect (given-positive-all-fours? 42) 0)
(check-expect (given-positive-all-fours? 43) 0)
(check-expect (given-positive-all-fours? 44) 1)
(check-expect (given-positive-all-fours? 45) 0)
(check-expect (given-positive-all-fours? 444) 1)
(check-expect (given-positive-all-fours? 443) 0)
(check-expect (given-positive-all-fours? 4444) 1)
(check-expect (given-positive-all-fours? 4443) 0)
(check-expect (given-positive-all-fours? 44444) 1)
(check-expect (given-positive-all-fours? 44443) 0)
;; test-Exercise09-increasing-digits?.imp
(check-expect (increasing-digits? 0) 1)
(check-expect (increasing-digits? 1) 1)
(check-expect (increasing-digits? 12) 1)
(check-expect (increasing-digits? 21) 0)
(check-expect (increasing-digits? 123) 1)
(check-expect (increasing-digits? 1123) 0)
(check-expect (increasing-digits? 12345) 1)
(check-expect (increasing-digits? 54321) 0)
(check-expect (increasing-digits? 12435) 0)
(check-expect (increasing-digits? 489) 1)
(check-expect (increasing-digits? 2468) 1)
(check-expect (increasing-digits? 2435) 0)
(check-expect (increasing-digits? -1) 1)
(check-expect (increasing-digits? -12) 1)
(check-expect (increasing-digits? -21) 0)
(check-expect (increasing-digits? -123) 1)
(check-expect (increasing-digits? -1123) 0)
(check-expect (increasing-digits? -12345) 1)
(check-expect (increasing-digits? -54321) 0)
(check-expect (increasing-digits? -12435) 0)
(check-expect (increasing-digits? -489) 1)
(check-expect (increasing-digits? -2468) 1)
(check-expect (increasing-digits? -2435) 0)
;; test-Exercise10-binary.imp
(check-expect (binary 0) 0)
(check-expect (binary 1) 1)
(check-expect (binary 2) 10)
(check-expect (binary 3) 11)
(check-expect (binary 4) 100)
(check-expect (binary 5) 101)
(check-expect (binary 11) 1011)
(check-expect (binary 12) 1100)
(check-expect (binary 13) 1101)
(check-expect (binary 14) 1110)
(check-expect (binary 15) 1111)
(check-expect (binary 16) 10000)
(check-expect (binary -5) -101)
(check-expect (binary -12) -1100)