From 78d68de282bc88eb9baffb620857fd6d1d14e5f5 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Fri, 24 Apr 2015 14:10:57 +0900 Subject: [PATCH] Adding missing test files from last commit. --- tests/snow/repo3/pythagoras/hyp.c | 5 +++++ tests/snow/repo3/pythagoras/hypotenuse-test.sch | 14 ++++++++++++++ tests/snow/repo3/pythagoras/hypotenuse.sch | 6 ++++++ tests/snow/repo3/pythagoras/hypotenuse.stub | 3 +++ 4 files changed, 28 insertions(+) create mode 100644 tests/snow/repo3/pythagoras/hyp.c create mode 100644 tests/snow/repo3/pythagoras/hypotenuse-test.sch create mode 100644 tests/snow/repo3/pythagoras/hypotenuse.sch create mode 100644 tests/snow/repo3/pythagoras/hypotenuse.stub diff --git a/tests/snow/repo3/pythagoras/hyp.c b/tests/snow/repo3/pythagoras/hyp.c new file mode 100644 index 00000000..71740b73 --- /dev/null +++ b/tests/snow/repo3/pythagoras/hyp.c @@ -0,0 +1,5 @@ +#include + +double hypotenuse(double a, double b) { + return sqrt(a*a + b*b); +} diff --git a/tests/snow/repo3/pythagoras/hypotenuse-test.sch b/tests/snow/repo3/pythagoras/hypotenuse-test.sch new file mode 100644 index 00000000..7e410e40 --- /dev/null +++ b/tests/snow/repo3/pythagoras/hypotenuse-test.sch @@ -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)) diff --git a/tests/snow/repo3/pythagoras/hypotenuse.sch b/tests/snow/repo3/pythagoras/hypotenuse.sch new file mode 100644 index 00000000..6f1a41ab --- /dev/null +++ b/tests/snow/repo3/pythagoras/hypotenuse.sch @@ -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")) diff --git a/tests/snow/repo3/pythagoras/hypotenuse.stub b/tests/snow/repo3/pythagoras/hypotenuse.stub new file mode 100644 index 00000000..91abb02a --- /dev/null +++ b/tests/snow/repo3/pythagoras/hypotenuse.stub @@ -0,0 +1,3 @@ +(c-include-verbatim "hyp.c") + +(define-c double hypotenuse (double double))