UNB/ CS/ David Bremner/ teaching/ cs2613/ tests/ T2/ q2-tests.js
test("empty array", (t)=> assert.deepEqual(strings([]),[]));
test("single element array", (t)=> assert.deepEqual(strings(["bob"]),
                                                    ["bob"]));
test("mixed strings and numbers", (t)=>
    assert.deepEqual(strings([1,"bob",2,"alice"]), ["bob","alice"]));
test("nested arrays", (t)=>
    assert.deepEqual(strings([1,"bob",[2,"alice"]]), ["bob","alice"]));
test("deeper nesting", (t)=>{
    const expr = [ '*', [ '*', 6, 9 ], [ '+', [ '*', 6, 9 ],
                                         [ '+', 6, 9 ] ] ];
    assert.deepEqual(strings(expr), ['*','*','+','*','+']);
});

test("empty object", (t)=> assert.deepEqual(strings({}),[]));
test("single field object",
     (t)=> assert.deepEqual(strings({ name: "bob"}),["bob"]));
test("mixed string and number fields",
     (t)=>assert.deepEqual(strings({age: 1, parent1: "bob",
                                    height: 2, parent2: "alice"}),
                           ["bob","alice"]));
test("nested objects",
     (t)=>assert.deepEqual(strings({ key: {receiver: "bob",
                                           other: {age: 2,
                                                   sender: "alice"} }}),
                           ["bob","alice"]));
test("deeper nesting",
     (t)=>{
         const expr = { op: '*', l: { op: '*', l: 6, r: 9 },
                        r: { op: '+', l: { op: '*', l: 6, r: 9 },
                             r: { op:'+', l: 6, r: 9 } } };
         assert.deepEqual(strings(expr), ['*','*','+','*','+']);
     });