// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Mocha from "mocha";
import * as Belt_List from "@rescript/runtime/lib/es6/Belt_List.mjs";
import * as Test_utils from "./test_utils.mjs";
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.mjs";
import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.mjs";

function f0(x) {
  let match = x[1];
  if (match !== undefined && match) {
    return 1;
  } else {
    return 2;
  }
}

function f1(u) {
  if (typeof u !== "object") {
    return 1;
  } else {
    return 0;
  }
}

function f2(x, y, zOpt, param) {
  let z = zOpt !== undefined ? zOpt : 3;
  console.log(x);
  if (y !== undefined) {
    return y + z | 0;
  } else {
    return 0;
  }
}

function f3(x) {
  if (x !== undefined) {
    return 1;
  } else {
    return 0;
  }
}

function f4(x) {
  if (x !== undefined) {
    return x + 1 | 0;
  } else {
    return 0;
  }
}

function f5(a) {
  return false;
}

function f6(a) {
  return true;
}

let f10 = Primitive_option.some(Primitive_option.some(Primitive_option.some(Primitive_option.some(undefined))));

let f11 = Primitive_option.some(f10);

let randomized = {
  contents: false
};

function create(randomOpt, param) {
  let random = randomOpt !== undefined ? randomOpt : randomized.contents;
  if (random) {
    return 2;
  } else {
    return 1;
  }
}

let ff = create(false, undefined);

function f13(xOpt, yOpt, param) {
  let x = xOpt !== undefined ? xOpt : 3;
  let y = yOpt !== undefined ? yOpt : 4;
  return x + y | 0;
}

let a = f13(2, undefined, undefined);

function f12(x) {
  return x;
}

let length_8_id = Belt_List.makeBy(8, x => x);

let length_10_id = Belt_List.makeBy(10, x => x);

function f13$1() {
  return Primitive_object.equal(Belt_List.take(length_10_id, 8), {
    hd: 1,
    tl: {
      hd: 2,
      tl: {
        hd: 3,
        tl: /* [] */0
      }
    }
  });
}

console.log(6, undefined);

function ltx(a, b) {
  if (Primitive_object.lessthan(a, b)) {
    return Primitive_object.greaterthan(b, a);
  } else {
    return false;
  }
}

function gtx(a, b) {
  if (Primitive_object.greaterthan(a, b)) {
    return Primitive_object.lessthan(b, a);
  } else {
    return false;
  }
}

function eqx(a, b) {
  if (Primitive_object.equal(a, b)) {
    return Primitive_object.equal(b, a);
  } else {
    return false;
  }
}

function neqx(a, b) {
  if (Primitive_object.notequal(a, b)) {
    return Primitive_object.notequal(b, a);
  } else {
    return false;
  }
}

function all_true(xs) {
  return Belt_List.every(xs, x => x);
}

Mocha.describe("Option_repr_test", () => {
  Mocha.test("option comparison operations", () => {
    Test_utils.ok("File \"option_repr_test.res\", line 117, characters 7-14", Primitive_object.lessthan(undefined, null));
    Test_utils.ok("File \"option_repr_test.res\", line 118, characters 7-14", !Primitive_object.greaterthan(undefined, null));
    Test_utils.ok("File \"option_repr_test.res\", line 119, characters 7-14", Primitive_object.greaterthan(null, undefined));
    Test_utils.ok("File \"option_repr_test.res\", line 120, characters 7-14", Primitive_object.lessthan(undefined, Primitive_option.some(undefined)));
    Test_utils.ok("File \"option_repr_test.res\", line 121, characters 7-14", Primitive_object.greaterthan(Primitive_option.some(undefined), undefined));
  });
  Mocha.test("option greater than operations", () => {
    let xs_0 = gtx(Primitive_option.some(null), Primitive_option.some(undefined));
    let xs = {
      hd: xs_0,
      tl: /* [] */0
    };
    Test_utils.ok("File \"option_repr_test.res\", line 125, characters 7-14", Belt_List.every(xs, x => x));
  });
  Mocha.test("option less than operations", () => {
    let xs_0 = Primitive_object.lessthan(Primitive_option.some(undefined), 3) && Primitive_object.greaterthan(3, Primitive_option.some(undefined));
    let xs_1 = {
      hd: Primitive_object.lessthan(Primitive_option.some(undefined), Primitive_option.some(Primitive_option.some(undefined))) && Primitive_object.greaterthan(Primitive_option.some(Primitive_option.some(undefined)), Primitive_option.some(undefined)),
      tl: {
        hd: Primitive_object.lessthan(Primitive_option.some(undefined), "3") && Primitive_object.greaterthan("3", Primitive_option.some(undefined)),
        tl: {
          hd: Primitive_object.lessthan(Primitive_option.some(undefined), true) && Primitive_object.greaterthan(true, Primitive_option.some(undefined)),
          tl: {
            hd: Primitive_object.lessthan(Primitive_option.some(undefined), false) && Primitive_object.greaterthan(false, Primitive_option.some(undefined)),
            tl: {
              hd: Primitive_object.lessthan(false, true) && Primitive_object.greaterthan(true, false),
              tl: {
                hd: Primitive_object.lessthan(false, true) && Primitive_object.greaterthan(true, false),
                tl: {
                  hd: Primitive_object.lessthan(undefined, Primitive_option.some(undefined)) && Primitive_object.greaterthan(Primitive_option.some(undefined), undefined),
                  tl: {
                    hd: ltx(undefined, null),
                    tl: {
                      hd: ltx(undefined, x => x),
                      tl: {
                        hd: ltx(null, 3),
                        tl: /* [] */0
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    };
    let xs = {
      hd: xs_0,
      tl: xs_1
    };
    Test_utils.ok("File \"option_repr_test.res\", line 130, characters 6-13", Belt_List.every(xs, x => x));
  });
  Mocha.test("option equality operations", () => {
    let xs_1 = {
      hd: neqx(undefined, null),
      tl: {
        hd: Primitive_object.equal(Primitive_option.some(undefined), Primitive_option.some(undefined)) && Primitive_object.equal(Primitive_option.some(undefined), Primitive_option.some(undefined)),
        tl: {
          hd: Primitive_object.equal(Primitive_option.some(Primitive_option.some(undefined)), Primitive_option.some(Primitive_option.some(undefined))) && Primitive_object.equal(Primitive_option.some(Primitive_option.some(undefined)), Primitive_option.some(Primitive_option.some(undefined))),
          tl: {
            hd: Primitive_object.notequal(Primitive_option.some(Primitive_option.some(Primitive_option.some(undefined))), Primitive_option.some(Primitive_option.some(undefined))) && Primitive_object.notequal(Primitive_option.some(Primitive_option.some(undefined)), Primitive_option.some(Primitive_option.some(Primitive_option.some(undefined)))),
            tl: /* [] */0
          }
        }
      }
    };
    let xs = {
      hd: true,
      tl: xs_1
    };
    Test_utils.ok("File \"option_repr_test.res\", line 149, characters 6-13", Belt_List.every(xs, x => x));
  });
});

let f7;

let f8 = Primitive_option.some(undefined);

let f9 = Primitive_option.some(Primitive_option.some(undefined));

let N;

let none_arg;

export {
  f0,
  f1,
  f2,
  f3,
  f4,
  f5,
  f6,
  f7,
  f8,
  f9,
  f10,
  f11,
  randomized,
  create,
  ff,
  a,
  f12,
  N,
  length_8_id,
  length_10_id,
  f13$1 as f13,
  none_arg,
  ltx,
  gtx,
  eqx,
  neqx,
  all_true,
}
/* ff Not a pure module */
