aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2018-05-21 18:53:38 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2018-05-21 18:53:38 -0400
commit373cb403871c0c77f26cb76213adde3aeb278240 (patch)
tree5d34ccc14eef51080a50a33f5a9cf1153d6295af
parent3e8fc5122fed2baee3a4d27d51575f6dd5174ea8 (diff)
A test for List.groupBy
-rw-r--r--tests/listGroupBy.ur13
-rw-r--r--tests/listGroupBy.urp4
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/listGroupBy.ur b/tests/listGroupBy.ur
new file mode 100644
index 00000000..c2419ce1
--- /dev/null
+++ b/tests/listGroupBy.ur
@@ -0,0 +1,13 @@
+fun lister () = List.tabulateM (fn _ => n <- rand; return (n % 100)) 8
+
+fun main () : transaction page =
+ inp <- source [];
+ return <xml><body>
+ <button value="Compute" onclick={fn _ =>
+ ls <- rpc (lister ());
+ set inp ls}/>
+
+ <dyn signal={inp <- signal inp; return (txt inp)}/>
+ -&gt;
+ <dyn signal={inp <- signal inp; return (txt (List.groupBy (fn n m => n % 2 = m % 2) inp))}/>
+ </body></xml>
diff --git a/tests/listGroupBy.urp b/tests/listGroupBy.urp
new file mode 100644
index 00000000..1a63a89d
--- /dev/null
+++ b/tests/listGroupBy.urp
@@ -0,0 +1,4 @@
+rewrite all ListGroupBy/*
+
+$/list
+listGroupBy \ No newline at end of file