summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/math.ur26
-rw-r--r--tests/normalizeTable.ur50
-rw-r--r--tests/normalizeTable.urp1
-rw-r--r--tests/normalizeTable.urs1
-rw-r--r--tests/timeout.ur22
-rw-r--r--tests/timeout.urp7
-rw-r--r--tests/timeout.urs1
7 files changed, 108 insertions, 0 deletions
diff --git a/tests/math.ur b/tests/math.ur
new file mode 100644
index 00000000..964b73e6
--- /dev/null
+++ b/tests/math.ur
@@ -0,0 +1,26 @@
+fun main () = return <xml><body>
+ <button value="Power 2.0 of 2.0!" onclick={fn _ => alert (show (pow 2.0 2.0))}/>
+ {[(pow 2.0 2.0)]}
+ <button value="Square root of 25!" onclick={fn _ => alert (show (sqrt 25.0))}/>
+ {[(sqrt 25.0)]}
+ <button value="Sin of 0.1!" onclick={fn _ => alert (show (sin 0.1))}/>
+ {[(sin 0.1)]}
+ <button value="Cos of 0.1!" onclick={fn _ => alert (show (cos 0.1))}/>
+ {[(cos 0.1)]}
+ <button value="log of 0.1!" onclick={fn _ => alert (show (log 0.1))}/>
+ {[(log 0.1)]}
+ <button value="Exp of 0.1!" onclick={fn _ => alert (show (exp 0.1))}/>
+ {[(exp 0.1)]}
+ <button value="asin of 0.1!" onclick={fn _ => alert (show (asin 0.1))}/>
+ {[(asin 0.1)]}
+ <button value="acos of 0.1!" onclick={fn _ => alert (show (acos 0.1))}/>
+ {[(acos 0.1)]}
+ <button value="atan of 0.1!" onclick={fn _ => alert (show (atan 0.1))}/>
+ {[(atan 0.1)]}
+ <button value="atan2 of 0.1 and -0.2!" onclick={fn _ => alert (show (atan2 0.1 (-0.2)))}/>
+ {[(atan2 0.1 (-0.2))]}
+ <button value="floor of 34.5!" onclick={fn _ => alert (show (floor 34.5))}/>
+ {[(floor 34.5)]}
+ <button value="abs of -10.0!" onclick={fn _ => alert (show (abs (-10.0)))}/>
+ {[(abs (-10.0))]}
+ </body></xml>
diff --git a/tests/normalizeTable.ur b/tests/normalizeTable.ur
new file mode 100644
index 00000000..be16d935
--- /dev/null
+++ b/tests/normalizeTable.ur
@@ -0,0 +1,50 @@
+fun main () =
+visible <- source True;
+return
+ <xml>
+ <body>
+ <section>
+ <h1>Static table</h1>
+ <table border=1>
+ <thead>
+ <tr>
+ <th>Column 0</th>
+ <th>Column 1</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>A</td>
+ <td>B</td>
+ </tr>
+ </tbody>
+ </table>
+ </section>
+
+ <section>
+ <h1>Dynamic table</h1>
+ <table border=1>
+ <thead>
+ <tr>
+ <th>Column 0</th>
+ <th>Column 1</th>
+ </tr>
+ </thead>
+ <tbody>
+ <dyn signal={
+ visible <- signal visible;
+ return (if visible then
+ <xml>
+ <tr>
+ <td>A</td>
+ <td>B</td>
+ </tr>
+ </xml>
+ else
+ <xml></xml>)
+ }/>
+ </tbody>
+ </table>
+ </section>
+ </body>
+ </xml>
diff --git a/tests/normalizeTable.urp b/tests/normalizeTable.urp
new file mode 100644
index 00000000..e22cda3b
--- /dev/null
+++ b/tests/normalizeTable.urp
@@ -0,0 +1 @@
+normalizeTable
diff --git a/tests/normalizeTable.urs b/tests/normalizeTable.urs
new file mode 100644
index 00000000..9e80cf40
--- /dev/null
+++ b/tests/normalizeTable.urs
@@ -0,0 +1 @@
+val main: unit -> transaction page
diff --git a/tests/timeout.ur b/tests/timeout.ur
new file mode 100644
index 00000000..d96b42bd
--- /dev/null
+++ b/tests/timeout.ur
@@ -0,0 +1,22 @@
+table listeners : { Ch : channel unit }
+
+fun ping () =
+ queryI1 (SELECT * FROM listeners)
+ (fn r => send r.Ch ())
+
+fun main () =
+ ch <- channel;
+ dml (INSERT INTO listeners(Ch) VALUES ({[ch]}));
+ count <- source 0;
+ return <xml><body onload={let
+ fun loop () =
+ _ <- recv ch;
+ c <- get count;
+ set count (c + 1);
+ loop ()
+ in
+ loop ()
+ end}>
+ <dyn signal={n <- signal count; return (txt n)}/>
+ <button onclick={fn _ => rpc (ping ())}>Ping</button>
+ </body></xml>
diff --git a/tests/timeout.urp b/tests/timeout.urp
new file mode 100644
index 00000000..6d3ca878
--- /dev/null
+++ b/tests/timeout.urp
@@ -0,0 +1,7 @@
+timeout 2
+rewrite url Timeout/*
+database dbname=test
+sql timeout.sql
+safeGet main
+
+timeout
diff --git a/tests/timeout.urs b/tests/timeout.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/timeout.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page