Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { max } from "./index";
- describe("max number integer", () => {
- test("first max", () => {
- expect(max(3, 2)).toBe(3);
- });
- test("second max", () => {
- expect(max(2, 3)).toBe(3);
- });
- test("2 zero", () => {
- expect(max(0, 0)).toBe(0);
- });
- test("1 zero, first int", () => {
- expect(max(2, 0)).toBe(2);
- });
- test("1 zero, second int", () => {
- expect(max(0, 2)).toBe(2);
- });
- test("integer equal", () => {
- expect(max(2, 2)).toBe(2);
- });
- });
- describe("max number float", () => {
- test("2 float, first max", () => {
- expect(max(2.22, 1.11)).toBe(2.22);
- });
- test("2 float, second max", () => {
- expect(max(1.11, 2.22)).toBe(2.22);
- });
- test("1 zero, first float", () => {
- expect(max(1.11, 0)).toBe(1.11);
- });
- test("1 zero, second float", () => {
- expect(max(0, 1.11)).toBe(1.11);
- });
- test("float equal", () => {
- expect(max(2.33, 2.33)).toBe(2.33);
- });
- });
- describe("max number integer negative", () => {
- test("2 int, 1 negative(second)", () => {
- expect(max(2, -2)).toBe(2);
- });
- test("2 int, 1 negative(first)", () => {
- expect(max(-2, 2)).toBe(2);
- });
- test("2 negative int, first max", () => {
- expect(max(-2, -3)).toBe(-2);
- });
- test("2 negative int, second max", () => {
- expect(max(-3, -2)).toBe(-2);
- });
- test("1 zero, first negative", () => {
- expect(max(-2, 0)).toBe(0);
- });
- test("1 zero, second negative", () => {
- expect(max(0, -2)).toBe(0);
- });
- });
- describe("max number float negative", () => {
- test("2 float, 1 negative(second)", () => {
- expect(max(2.22, -2.32)).toBe(2.22);
- });
- test("2 float, 1 negative(first)", () => {
- expect(max(-2.22, 2.32)).toBe(2.32);
- });
- test("2 negative float, first max", () => {
- expect(max(-2.22, -3.22)).toBe(-2.22);
- });
- test("2 negative float, second max", () => {
- expect(max(-3.22, -2.22)).toBe(-2.22);
- });
- test("1 zero, first negative float", () => {
- expect(max(-2.22, 0)).toBe(0);
- });
- test("1 zero, second negative float", () => {
- expect(max(0, -2.22)).toBe(0);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment