import chai from "chai";
let expect = chai.expect;

export function polynomA(Xvalue: number) {
  return 3 * Xvalue * Xvalue + 2 * Xvalue + 1;
}

describe("From poly file", () => {
  describe("Testing poly function for trival values", () => {
    it("Is polynom A equal to 1 for x = 0?", () => {
      let result = polynomA(0);
      expect(result).is.equal(1);
    });
    it("Is polynom A equal to 6 for x = 1?", () => {
      let result = polynomA(1);
      expect(result).is.equal(6);
    });
    it("Is polynom A equal to 2 for x = -1?", () => {
      let result = polynomA(-1);
      expect(result).is.equal(2);
    });
  });
  describe("Testing poly function with random values", () => {
    let x = Math.floor(Math.random() * 100) + 2;
    let result = polynomA(x);
    it("The polynom is greater then 0", () => {
      expect(result).is.greaterThan(0);
    });
    it("The polynom is greater then x", () => {
      expect(result).is.greaterThan(x);
    });
  });
});
