CS2613/labs/L10/spec/rec_vs_loop.spec.js
2022-10-17 10:24:22 -03:00

31 lines
685 B
JavaScript

let loop_arith=require ("../loop-arith.js");
let rec_arith=require ("../rec-arith.js");
describe("plus",
function() {
it("1 + 1 = 2",
function() {
expect(loop_arith.plus(1, 1)).toBe(rec_arith.plus(1, 1));
});
it("0 + x = x",
function() {
expect(loop_arith.plus(0, 1)).toBe(rec_arith.plus(0, 1));
});
});
describe("mult",
function() {
it("0 * 2 = 0",
function() {
expect(loop_arith.mult(0, 2)).toBe(rec_arith.mult(0, 2));
});
it("1 * 2 = 2",
function() {
expect(loop_arith.mult(1, 2)).toBe(rec_arith.mult(1, 2));
});
it("2 * 2 = 4",
function() {
expect(loop_arith.mult(2, 2)).toBe(rec_arith.mult(2, 2));
});
});