您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

38 行
739 B

  1. (define (test-cond x)
  2. (cond ((< 0 x) +1)
  3. ((> 0 x) -1)
  4. (else 0)))
  5. (assert (= (test-cond 10) 1))
  6. (assert (= (test-cond 1) 1))
  7. (assert (= (test-cond 123) 1))
  8. (assert (= (test-cond -10) -1))
  9. (assert (= (test-cond -1) -1))
  10. (assert (= (test-cond -123) -1))
  11. (assert (= (test-cond 0) 0))
  12. (assert (= (test-cond -0) 0))
  13. (assert (= (test-cond +0) 0))
  14. (define (test-case x)
  15. (case x
  16. ((a b 3) 1)
  17. ((4 5 6) -1)
  18. (else 'xD)))
  19. (assert (= (test-case 'a) 1))
  20. (assert (= (test-case 'b) 1))
  21. (assert (= (test-case 3) 1))
  22. (assert (= (test-case 4) -1))
  23. (assert (= (test-case 5) -1))
  24. (assert (= (test-case 6) -1))
  25. (assert (= (test-case 0) 'xD))
  26. (assert (= (test-case 1) 'xD))
  27. (assert (= (test-case :asd) 'xD))