class DynamicArrayTest {
test_get_usingStrings() {
let nm1 = 'Asha';
let nm2 = 'Kofi';
let dynamic = DynamicArray.newEmpty();
dynamic.add(nm1);
dynamic.add(nm2);
var result, expected;
result = dynamic.get(0);
expected = nm1;
this.show(result.toString());
this.show(expected.toString());
result = dynamic.get(1);
expected = nm2;
this.show(result.toString());
this.show(expected.toString());
//we could also test "first" and "last" the same way
}
//...
}
class DynamicArrayTest {
test_get_usingProperObjects() {
let customer1 = Customer.fromFnameLnamePhoneZip('Kofi', 'Lee', '1112223333', 55100);
let customer2 = Customer.fromFnameLnamePhoneZip('Asha', 'Woods', '9991231234', 55300);
let dynamic = DynamicArray.newEmpty();
dynamic.add(customer1);
dynamic.add(customer2);
var result, expected;
result = dynamic.get(0);
expected = customer1;
this.show(result.toString());
this.show(expected.toString());
result = dynamic.get(1);
expected = customer2;
this.show(result.toString());
this.show(expected.toString());
}
//...
}