[template-glib] tests: add simple pow() test
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [template-glib] tests: add simple pow() test
- Date: Wed, 4 May 2022 22:07:20 +0000 (UTC)
commit a7150207772f10367b0a0beb1766c24cedba0fec
Author: Christian Hergert <chergert redhat com>
Date: Wed May 4 14:54:50 2022 -0700
tests: add simple pow() test
Builtins can only take a single parameter currently, so pow() cannot
currently be hoisted asa builtin. Test something dumb as a fallback.
tests/test1.script | 3 +++
1 file changed, 3 insertions(+)
---
diff --git a/tests/test1.script b/tests/test1.script
index 737f45c..0f99478 100644
--- a/tests/test1.script
+++ b/tests/test1.script
@@ -18,6 +18,9 @@ assert(abc == "abc")
assert(abc != "abc\n")
assert(abc != "def")
+func pow(a,b) = while b > 1 do a = a * a; b = b - 1;
+assert(pow(2,3) == 8)
+
func multiply(x,y) = x * y;
assert(multiply(10, 10) == 100)
assert(multiply(-10, 10) == -100)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]