diff options
Diffstat (limited to 'tests/tcurrncy.nim')
-rwxr-xr-x | tests/tcurrncy.nim | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/tests/tcurrncy.nim b/tests/tcurrncy.nim deleted file mode 100755 index fa08d620b..000000000 --- a/tests/tcurrncy.nim +++ /dev/null @@ -1,32 +0,0 @@ -template Additive(typ: typeDesc): stmt = - proc `+` *(x, y: typ): typ {.borrow.} - proc `-` *(x, y: typ): typ {.borrow.} - - # unary operators: - proc `+` *(x: typ): typ {.borrow.} - proc `-` *(x: typ): typ {.borrow.} - -template Multiplicative(typ, base: typeDesc): stmt = - proc `*` *(x: typ, y: base): typ {.borrow.} - proc `*` *(x: base, y: typ): typ {.borrow.} - proc `div` *(x: typ, y: base): typ {.borrow.} - proc `mod` *(x: typ, y: base): typ {.borrow.} - -template Comparable(typ: typeDesc): stmt = - proc `<` * (x, y: typ): bool {.borrow.} - proc `<=` * (x, y: typ): bool {.borrow.} - proc `==` * (x, y: typ): bool {.borrow.} - -template DefineCurrency(typ, base: expr): stmt = - type - typ* = distinct base - Additive(typ) - Multiplicative(typ, base) - Comparable(typ) - - proc `$` * (t: typ): string {.borrow.} - -DefineCurrency(TDollar, int) -DefineCurrency(TEuro, int) -echo($( 12.TDollar + 13.TDollar )) #OUT 25 - |