CS2613/labs/L09/spec/loop-arith.spec.js

43 lines
719 B
JavaScript
Raw Normal View History

2022-10-12 09:04:35 -03:00
let arith=require ("../loop-arith.js");
2022-10-12 11:10:43 -03:00
describe("plus",
2022-10-12 09:04:35 -03:00
function() {
it("1 + 1 = 2",
function() {
2022-10-12 09:15:48 -03:00
expect(arith.plus(1, 1)).toBe(2);
2022-10-12 09:04:35 -03:00
});
it("0 + x = x",
function() {
2022-10-12 09:15:48 -03:00
expect(arith.plus(0, 1)).toBe(1);
2022-10-12 09:04:35 -03:00
});
});
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() {
2022-10-12 11:10:43 -03:00
expect(arith.mult(2, 2)).toBe(4);
2022-10-12 09:04:35 -03:00
});
2022-10-12 11:10:43 -03:00
});
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);
});
});