Update lab 9 content

This commit is contained in:
Isaac Shoebottom
2022-10-12 11:10:43 -03:00
parent f62c83ddbe
commit eefd47a0fc
9 changed files with 174 additions and 14 deletions

View File

@ -0,0 +1,17 @@
let by_name=require("../ancestry.js").by_name;
describe("by_name", function() {
it("not-present", function() {
expect(by_name("ronald mcdonald")).toBe(null);
expect(by_name("Captain Ahab")).toBe(null);
});
it("first", function () {
expect(by_name("Carolus Haverbeke")).toEqual({"name": "Carolus Haverbeke", "sex": "m", "born": 1832, "died": 1905, "father": "Carel Haverbeke", "mother": "Maria van Brussel"});
});
it("last", function () {
expect(by_name("Jacobus Bernardus van Brussel")).toEqual({"name": "Jacobus Bernardus van Brussel", "sex": "m", "born": 1736, "died": 1809, "father": "Jan van Brussel", "mother": "Elisabeth Haverbeke"});
});
it("middle", function () {
expect(by_name("Joanna de Pape")).toEqual( {"name": "Joanna de Pape", "sex": "f", "born": 1654, "died": 1723, "father": "Vincent de Pape", "mother": "Petronella Wauters"});
});
});

View File

@ -1,6 +1,6 @@
let arith=require ("../loop-arith.js");
describe("add",
describe("plus",
function() {
it("1 + 1 = 2",
function() {
@ -25,6 +25,19 @@ describe("mult",
});
it("2 * 2 = 4",
function() {
expect(arith.mult(2, 2)).toBe(4)
expect(arith.mult(2, 2)).toBe(4);
});
});
});
describe("minus",
function() {
it("1 - 1 = 0",
function() {
expect(arith.minus(1, 1)).toBe(0);
});
it("0 - x = -x",
function() {
expect(arith.minus(0, 1)).toBe(-1);
});
});