summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-08-17 12:35:43 +0100
committerubq323 <ubq323@ubq323.website>2024-08-17 12:35:43 +0100
commit05cfb9bf2461785ec621b490747f48b96344017f (patch)
tree0b9fc13d8509b24c3950c668c9aa4cc28bcfa492 /tests
parent14b6304bb416795ca1016e9ce5f052b0861e5a48 (diff)
sin, cos, more checks
Diffstat (limited to 'tests')
-rw-r--r--tests/sin.bth14
-rw-r--r--tests/sin.out50
-rw-r--r--tests/sincos.bth37
3 files changed, 101 insertions, 0 deletions
diff --git a/tests/sin.bth b/tests/sin.bth
new file mode 100644
index 0000000..319241f
--- /dev/null
+++ b/tests/sin.bth
@@ -0,0 +1,14 @@
+(defn (ts x)
+ (* 10 (+ 1 (sin x))))
+
+(set! _G_ts ts)
+
+(defn (p t)
+ (for (i (_G_ts t))
+ (write " "))
+ (say 'x))
+
+
+
+(for (i 50) (p (/ i 8)))
+
diff --git a/tests/sin.out b/tests/sin.out
new file mode 100644
index 0000000..3519c6d
--- /dev/null
+++ b/tests/sin.out
@@ -0,0 +1,50 @@
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
+ x
diff --git a/tests/sincos.bth b/tests/sincos.bth
new file mode 100644
index 0000000..7f6a135
--- /dev/null
+++ b/tests/sincos.bth
@@ -0,0 +1,37 @@
+(defn (ts x)
+ (* 10 (+ 1 (sin x))))
+(defn (tc x)
+ (* 10 (+ 1 (cos x))))
+(set! _G_ts ts)
+(set! _G_tc tc)
+
+(defn (min x y)
+ (if (< x y) x y))
+(defn (max x y)
+ (if (< x y) y x))
+(set! _G_min min)
+(set! _G_max max)
+
+(defn (ws n)
+ (for (i (- n 1)) (write " "))
+ (say 'x))
+(set! _G_ws ws)
+
+(defn (p2 t)
+ (let (s (_G_ts t)
+ c (_G_tc t)
+ fs (floor s)
+ fc (floor c)
+ m (_G_min fs fc)
+ M (_G_max fs fc)
+ d (- M m))
+ (if (= 0 d)
+ (_G_ws m)
+ (do (_G_ws m) (_G_ws d)))))
+
+
+
+
+
+(for (i 100) (p2 (/ i 16)))
+