aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lux-mode/lux-mode.el2
-rw-r--r--luxc/src/lux/lexer.clj2
-rw-r--r--stdlib/test/test/lux.lux68
3 files changed, 29 insertions, 43 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el
index 9961dd7ca..5d42b66b8 100644
--- a/lux-mode/lux-mode.el
+++ b/lux-mode/lux-mode.el
@@ -261,7 +261,7 @@ Called by `imenu--generic-function'."
; Frac "ratio" literals
("\\<-?[0-9][0-9_]*/[0-9][0-9_]*\\>" 0 font-lock-constant-face)
; Rev literals
- ("\\<\\(\\.[0-9][0-9_]*\\)\\>" 0 font-lock-constant-face)
+ ("\\<\\.[0-9][0-9_]*\\>" 0 font-lock-constant-face)
; Tags
("#\\.[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face)
("#\\.\\.[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face)
diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj
index 4ff0af4f2..d56a901ff 100644
--- a/luxc/src/lux/lexer.clj
+++ b/luxc/src/lux/lexer.clj
@@ -140,7 +140,7 @@
lex-nat $Nat #"^\+[0-9][0-9_]*"
lex-int $Int #"^-?[0-9][0-9_]*"
- lex-rev $Rev #"^\.[0-9][0-9_]+"
+ lex-rev $Rev #"^\.[0-9][0-9_]*"
lex-frac $Frac #"^-?[0-9][0-9_]*\.[0-9_]+((e|E)(-|\+)?[0-9][0-9_]*)?"
)
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux
index 211cf6d6b..ec3c82197 100644
--- a/stdlib/test/test/lux.lux
+++ b/stdlib/test/test/lux.lux
@@ -1,7 +1,7 @@
(.module:
lux
lux/test
- (lux (control ["M" monad #+ do Monad])
+ (lux (control [monad #+ do])
[math]
["r" math/random]
(data [maybe]
@@ -27,58 +27,44 @@
))))
(do-template [category rand-gen even? odd? = < >]
- [(context: (format "[" category "] " "Moving up-down or down-up should result in same value.")
+ [(context: (format "[" category "] " "Simple operations.")
(<| (times +100)
(do @
[value rand-gen]
- (test "" (and (|> value inc dec (= value))
- (|> value dec inc (= value)))))))
-
- (context: (format "[" category "] " "(x+1) > x && (x-1) < x")
- (<| (times +100)
- (do @
- [value rand-gen]
- (test "" (and (|> value inc (> value))
- (|> value dec (< value)))))))
-
- (context: (format "[" category "] " "Every odd/even number is surrounded by two of the other kind.")
- (<| (times +100)
- (do @
- [value rand-gen]
- (test ""
- (if (even? value)
- (and (|> value inc odd?)
- (|> value dec odd?))
- (and (|> value inc even?)
- (|> value dec even?)))))))]
+ ($_ seq
+ (test (format "[" category "] " "Moving up-down or down-up should result in same value.")
+ (and (|> value inc dec (= value))
+ (|> value dec inc (= value))))
+ (test (format "[" category "] " "(x+1) > x && (x-1) < x")
+ (and (|> value inc (> value))
+ (|> value dec (< value))))
+ (test (format "[" category "] " "Every odd/even number is surrounded by two of the other kind.")
+ (if (even? value)
+ (and (|> value inc odd?)
+ (|> value dec odd?))
+ (and (|> value inc even?)
+ (|> value dec even?))))))))]
["Nat" r.nat n/even? n/odd? n/= n/< n/>]
["Int" r.int i/even? i/odd? i/= i/< i/>]
)
(do-template [category rand-gen = < > <= >= min max]
- [(context: (format "[" category "] " "The symmetry of numerical comparisons.")
- (<| (times +100)
- (do @
- [x rand-gen
- y rand-gen]
- (test ""
- (or (= x y)
- (if (< y x)
- (> x y)
- (< x y)))))))
-
- (context: (format "[" category "] " "Minimums and maximums.")
+ [(context: (format "[" category "] " "(More) simple operations.")
(<| (times +100)
(do @
[x rand-gen
y rand-gen]
- (test ""
- (and (and (<= x (min x y))
- (<= y (min x y)))
- (and (>= x (max x y))
- (>= y (max x y)))
- )))))]
+ (seq (test (format "[" category "] " "The symmetry of numerical comparisons.")
+ (or (= x y)
+ (if (< y x)
+ (> x y)
+ (< x y))))
+ (test (format "[" category "] " "Minimums and maximums.")
+ (and (and (<= x (min x y))
+ (<= y (min x y)))
+ (and (>= x (max x y))
+ (>= y (max x y)))))))))]
["Int" r.int i/= i/< i/> i/<= i/>= i/min i/max]
["Nat" r.nat n/= n/< n/> n/<= n/>= n/min n/max]
@@ -145,7 +131,7 @@
(def: frac-rev
(r.Random Rev)
(|> r.rev
- (:: r.Functor<Random> map (|>> (bit.left-shift +11) (bit.right-shift +11)))))
+ (:: r.Functor<Random> map (|>> (bit.left-shift +11) (bit.logical-right-shift +11)))))
(do-template [category rand-gen -> <- = <cap>]
[(context: (format "[" category "] " "Numeric conversions")