diff options
author | Masaya Tojo <masaya@tojo.tokyo> | 2024-06-14 10:50:44 +0900 |
---|---|---|
committer | Masaya Tojo <masaya@tojo.tokyo> | 2024-06-14 10:50:44 +0900 |
commit | 1f60d4a7e3e4804ac68592bdbb7e9827fee1adbf (patch) | |
tree | a3f0c17b889c9f3faec7418d03f8fa19a93635df /tests | |
parent | dee1a5f3fc8862e7356a60a387fedd254bea6434 (diff) |
Add semigroup
Diffstat (limited to 'tests')
-rw-r--r-- | tests/run.scm | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/tests/run.scm b/tests/run.scm index 8d78396..6110b98 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -2,29 +2,43 @@ (test-begin "algebraic-structures") -(test-begin "monoid") +(test-begin "semigroup") -(import (algebraic-structures monoid)) +(import (algebraic-structures semigroup)) -(module (mod7 monoid) = (algebraic-structures monoid) +(module (mod7 semigroup) = (algebraic-structures semigroup) (import scheme (chicken module) (chicken base)) - (export <> unit) + (export <>) (define (<> x y) (assert (integer? x)) (assert (integer? y)) (assert (not (zero? x))) (assert (not (zero? y))) - (modulo (* x y) 7)) + (modulo (* x y) 7))) + +(import (prefix (algebraic-structures semigroup) mod7:<>)) + +(test 5 (mod7:<> 3 4)) + +(test-end "semigroup") + +(import (algebraic-structures monoid)) + +(module (mod7 monoid) = (algebraic-structures monoid) + (import scheme + (chicken module) + (chicken base)) + (reexport (mod7 semigroup)) + (export unit) (define unit 1)) (import (prefix (mod7 monoid) mod7:) (srfi 1)) -(test 5 (mod7:<> 3 4)) (test 1 mod7:unit) (test-end "monoid") @@ -95,18 +109,25 @@ (test-begin "monoid.fold") -(module (product monoid) = (algebraic-structures monoid) +(module (product semigroup) = (algebraic-structures semigroup) (import scheme (chicken base) (chicken module)) - (export <> unit) + (export <>) (define (<> x y) (assert (number? x)) (assert (not (zero? x))) (assert (number? y)) (assert (not (zero? y))) - (* x y)) + (* x y))) + +(module (product monoid) = (algebraic-structures monoid) + (import scheme + (chicken base) + (chicken module)) + (reexport (product semigroup)) + (export unit) (define unit 1)) |