mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Adding missing test files from last commit.
This commit is contained in:
parent
ac53193e5d
commit
78d68de282
4 changed files with 28 additions and 0 deletions
5
tests/snow/repo3/pythagoras/hyp.c
Normal file
5
tests/snow/repo3/pythagoras/hyp.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <math.h>
|
||||
|
||||
double hypotenuse(double a, double b) {
|
||||
return sqrt(a*a + b*b);
|
||||
}
|
14
tests/snow/repo3/pythagoras/hypotenuse-test.sch
Normal file
14
tests/snow/repo3/pythagoras/hypotenuse-test.sch
Normal file
|
@ -0,0 +1,14 @@
|
|||
(import (scheme base) (scheme process-context) (pythagoras hypotenuse))
|
||||
|
||||
(define (test expect expr)
|
||||
(cond
|
||||
((not (equal? expect expr))
|
||||
(write-string "FAIL\n")
|
||||
(exit #f))))
|
||||
|
||||
(test 5.0 (hypotenuse 3.0 4.0))
|
||||
(test 13.0 (hypotenuse 5.0 12.0))
|
||||
(test 25.0 (hypotenuse 7.0 24.0))
|
||||
(test 17.0 (hypotenuse 8.0 15.0))
|
||||
(test 41.0 (hypotenuse 9.0 40.0))
|
||||
(test 61.0 (hypotenuse 11.0 60.0))
|
6
tests/snow/repo3/pythagoras/hypotenuse.sch
Normal file
6
tests/snow/repo3/pythagoras/hypotenuse.sch
Normal file
|
@ -0,0 +1,6 @@
|
|||
;;> Utility to determine the length of the hypotenuse of a right
|
||||
;;> triangle given the other two sides.
|
||||
|
||||
(define-library (pythagoras hypotenuse)
|
||||
(export hypotenuse)
|
||||
(include-shared "hypotenuse"))
|
3
tests/snow/repo3/pythagoras/hypotenuse.stub
Normal file
3
tests/snow/repo3/pythagoras/hypotenuse.stub
Normal file
|
@ -0,0 +1,3 @@
|
|||
(c-include-verbatim "hyp.c")
|
||||
|
||||
(define-c double hypotenuse (double double))
|
Loading…
Add table
Reference in a new issue