Created
June 12, 2019 02:23
-
-
Save joseoliv/c1d517fc52d83a8815db6c75ff78ae49 to your computer and use it in GitHub Desktop.
concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package metaobjectTest | |
import generic | |
@doc{* | |
Annotation 'concept' should be attached to a prototype. It tests | |
whether one or more prototypes obey some restrictions. That | |
includes parameters to the generic prototype. | |
*} | |
object Concept | |
func run { | |
var GroupWork<IntGroupPlus> gwi = GroupWork<IntGroupPlus> new; | |
var a = IntGroupPlus(1); | |
var b = IntGroupPlus(5); | |
var c = IntGroupPlus(11); | |
var zero = IntGroupPlus(0); | |
assert a inverse inverse == a; | |
assert a unit == zero; | |
assert a * a inverse == zero; | |
assert a * a unit == a; | |
assert (b inverse * a inverse) * a * b == a unit; | |
assert (c inverse * b inverse * a inverse) * a * b * c == zero; | |
assert b * b * a == c && c * b inverse * a inverse == b; | |
GroupWork<IntGroupPlus> work: a, b, c; | |
GroupWork<IntGroupPlus> workout: a, b, c; | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment