aboutsummaryrefslogtreecommitdiff
path: root/tests/space_comb.js
blob: 819ee5c4c08bcd57ff70c011abb2a7168b77e0b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Tests space.comb()

const Space = require('../space');

newspace = new Space();
newspace.adhoc('\
line1\n\
&&&&transparency&&&&\n\
\n\
afterempty\n')

empty = new Space();

otherspace = new Space();
otherspace.adhoc('\
&&&transparency&&&\n\
testline');

function add(char1,char2){
  if (char1 == '') return char2;
  else return char1;
}

otherspace.loc = [0,0];
newspace.loc = [0,0];
otherspace.comb(newspace, add);

empty.comb(otherspace, add);
otherspace.loc = [8,0];
empty.comb(otherspace, add);
newspace.loc = [0, -32];
empty.comb(newspace, add);
console.log(otherspace.print());
console.log('--------');
console.log(empty.print()); // Should be equal to otherspace slightly displaced