CS2613/labs/L10/spec/rec_arith.spec.js

30 lines
515 B
JavaScript
Raw Permalink Normal View History

2022-10-17 10:24:22 -03:00
let arith=require ("../rec-arith.js");
describe("plus",
function() {
it("1 + 1 = 2",
function() {
expect(arith.plus(1, 1)).toBe(2);
});
it("0 + x = x",
function() {
expect(arith.plus(0, 1)).toBe(1);
});
});
describe("mult",
function() {
it("0 * 2 = 0",
function() {
expect(arith.mult(0, 2)).toBe(0);
});
it("1 * 2 = 2",
function() {
expect(arith.mult(1,2)).toBe(2);
});
it("2 * 2 = 4",
function() {
expect(arith.mult(2, 2)).toBe(4);
});
});