Created
October 20, 2014 01:28
-
-
Save krtx/debfce8b5043094f284b to your computer and use it in GitHub Desktop.
test for ex 1.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use gauche.test) | |
(test-start "test") | |
;; insert here | |
(define target PROGRAM-NAME) | |
(define (right a b c) | |
(let ((l (sort (list a b c) >))) | |
(let ((x (list-ref l 0)) | |
(y (list-ref l 1))) | |
(+ (* x x) (* y y))))) | |
(test* "1 2 3" (right 1 2 3) (target 1 2 3)) | |
(test* "1 3 2" (right 1 3 2) (target 1 3 2)) | |
(test* "2 1 3" (right 2 1 3) (target 2 1 3)) | |
(test* "2 3 1" (right 2 3 1) (target 2 3 1)) | |
(test* "3 1 2" (right 3 1 2) (target 3 1 2)) | |
(test* "3 2 1" (right 3 2 1) (target 3 2 1)) | |
(test* "1 1 3" (right 1 1 3) (target 1 1 3)) | |
(test* "1 3 1" (right 1 3 1) (target 1 3 1)) | |
(test* "3 1 1" (right 3 1 1) (target 3 1 1)) | |
(test* "1 1 1" (right 1 1 1) (target 1 1 1)) | |
(test* "1 2 -3" (right 1 2 -3) (target 1 2 -3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ gosh test-ex1.3.scm
;; Gauche だけどこれくらいなら処理系依存の機能はないだろう、ということで