aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-18 14:42:20 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-18 14:42:20 -0500
commitd024510e8d2e75683f5499cac54271f1bdbfd498 (patch)
treee5e2eab78a094d3b815163626f428c5e08a77389 /tests
parent78a5f75d9501774e6a8b12c357afbe8404b10f36 (diff)
tested and fixed processing bugs in space
Diffstat (limited to 'tests')
-rw-r--r--tests/space_comb.js24
-rw-r--r--tests/space_fromfetch.js9
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/space_comb.js b/tests/space_comb.js
new file mode 100644
index 0000000..3fae916
--- /dev/null
+++ b/tests/space_comb.js
@@ -0,0 +1,24 @@
+// Tests space.comb()
+
+space = require('../space');
+
+newspace = new space.Space();
+newspace.adhoc('\
+line1\n\
+&&&&transparency&&&&\n\
+\n\
+afterempty\n')
+
+otherspace = new space.Space();
+otherspace.adhoc('\
+&&&transparency&&&\n\
+testline');
+
+function add(char1,char2){
+ if (char1 == '') return char2;
+ else return char1;
+}
+
+otherspace.comb(newspace, add, [0,0]);
+
+console.log(otherspace.print());
diff --git a/tests/space_fromfetch.js b/tests/space_fromfetch.js
new file mode 100644
index 0000000..2d8572a
--- /dev/null
+++ b/tests/space_fromfetch.js
@@ -0,0 +1,9 @@
+// Tets Space.fromfetch
+const space = require('../space')
+
+newspace = new space.Space()
+
+newspace.fromfetch({"4,2": {"content": " hhhhhhhh k hone ns ", "properties": {"writability": null, "cell_props": {}}}},[4,2,4,2],conform=false);
+// Straight from a real tileUpdate
+
+console.log(newspace.data); //Should be an array of arrays of chars, representing the content of "content" above.