summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkira TAGOH <akira@tagoh.org>2006-10-12 14:49:03 +0000
committerAkira TAGOH <akira@tagoh.org>2006-10-12 14:49:03 +0000
commit10841242926ce65b83460759336d919328ad26fe (patch)
tree73fd9907965186a23eeae9b3b14d24131c9f9baa
parent5e17ef82d3c32f89e1ac0fbaba781d0f6b28dea4 (diff)
* tests/ps/test-exp.ps: new testcase.
* tests/ps/test-ps.sh (run_test): new function. * hieroglyph/scanner.c (_hg_scanner_parse_number): fixed a typo.
-rw-r--r--ChangeLog6
-rw-r--r--hieroglyph/scanner.c4
-rw-r--r--hieroglyph/version.h.in2
-rw-r--r--tests/ps/test-exp.ps12
-rwxr-xr-xtests/ps/test-ps.sh17
5 files changed, 34 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 69c553c..e4ba90b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2006-10-12 Akira TAGOH <at@gclab.org>
+ * tests/ps/test-exp.ps: new testcase.
+
+ * tests/ps/test-ps.sh (run_test): new function.
+
+ * hieroglyph/scanner.c (_hg_scanner_parse_number): fixed a typo.
+
* hieroglyph/operator.c (_hg_operator_op_exit): throw /invalidexit
if it's going to jump stopped context.
(_hg_operator_op_private_hg_exit): new function to not check
diff --git a/hieroglyph/scanner.c b/hieroglyph/scanner.c
index 3c8c738..76b7d2e 100644
--- a/hieroglyph/scanner.c
+++ b/hieroglyph/scanner.c
@@ -828,9 +828,9 @@ _hg_scanner_parse_number(HgVM *vm,
if (floatarray) {
length = hg_int_array_length(floatarray);
for (j = 0; j < length; j++) {
- dd += ((gdouble)hg_int_array_index(floatarray, j) * exp10((gdouble)-((j + 1) * 9)));
+ dd += ((gdouble)hg_int_array_index(floatarray, j) * exp10(-(gdouble)((j + 1) * 9)));
}
- dd += (i * exp10(-(gdouble)digits));
+ dd += (i * exp10(-(gdouble)(j * 9 + digits)));
digits = 0;
i = 0;
}
diff --git a/hieroglyph/version.h.in b/hieroglyph/version.h.in
index 52e53d8..673724d 100644
--- a/hieroglyph/version.h.in
+++ b/hieroglyph/version.h.in
@@ -29,7 +29,7 @@
G_BEGIN_DECLS
#define HIEROGLYPH_VERSION "@VERSION@"
-#define HIEROGLYPH_UUID "904f86ac-9ba1-4397-8efe-a26e084626a7"
+#define HIEROGLYPH_UUID "33fec7b4-e2db-4649-b932-4b4d6505ed9b"
const char *__hg_rcsid G_GNUC_UNUSED = "$Rev$";
diff --git a/tests/ps/test-exp.ps b/tests/ps/test-exp.ps
new file mode 100644
index 0000000..ac05247
--- /dev/null
+++ b/tests/ps/test-exp.ps
@@ -0,0 +1,12 @@
+initunittest
+
+true /exp [[/integertype /realtype] dup] typecheck
+false /exp [[/booleantype /nametype /arraytype /stringtype /dicttype /nulltype /operatortype /marktype /filetype /savetype /proctype]] typecheck
+
+[] /stackunderflow true initunittestdict {exp} unittest
+[1] /stackunderflow true initunittestdict {1 exp} unittest
+[0 0] /undefinedresult true initunittestdict {0 0 exp} unittest
+[3.0] null true initunittestdict {9 0.5 exp} unittest
+[-0.1111111111111111] null true initunittestdict {-9 -1 exp} unittest
+
+unittestresult
diff --git a/tests/ps/test-ps.sh b/tests/ps/test-ps.sh
index 14f8d1e..6a4c0c4 100755
--- a/tests/ps/test-ps.sh
+++ b/tests/ps/test-ps.sh
@@ -2,12 +2,21 @@
set -e
+function run_test() {
+ echo `basename $1`:
+ ./tests/run.sh ./src/hgs -d QUIET -l test $1
+}
+
rootdir=`dirname $0`/../..
pushd $rootdir
export HIEROGLYPH_LIB_PATH=./plugins/test
-for i in ./tests/ps/test-*.ps; do
- echo `basename $i`:
- ./tests/run.sh ./src/hgs -d QUIET -l test $i
-done
+
+if [ $# -ne 0 ]; then
+ run_test $1
+else
+ for i in ./tests/ps/test-*.ps; do
+ run_test $i
+ done
+fi
popd