Skip to content

Instantly share code, notes, and snippets.

@krtx
Created October 20, 2014 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krtx/debfce8b5043094f284b to your computer and use it in GitHub Desktop.
Save krtx/debfce8b5043094f284b to your computer and use it in GitHub Desktop.
test for ex 1.3
(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))
@krtx
Copy link
Author

krtx commented Oct 20, 2014

  • insert here にプログラムを貼り付け
  • PROGRAM-NAME を変更して

$ gosh test-ex1.3.scm

;; Gauche だけどこれくらいなら処理系依存の機能はないだろう、ということで

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment