// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Test from "./Test.mjs";
import * as Stdlib_Result from "@rescript/runtime/lib/es6/Stdlib_Result.mjs";
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.mjs";

let eq = Primitive_object.equal;

function forEachIfOkCallFunction() {
  let called = {
    contents: []
  };
  Stdlib_Result.forEach({
    TAG: "Ok",
    _0: 3
  }, i => {
    called.contents.push(i);
  });
  Test.run([
    [
      "Stdlib_ResultTests.res",
      10,
      22,
      72
    ],
    "forEach: if ok, call function with ok value once"
  ], called.contents, eq, [3]);
}

forEachIfOkCallFunction();

function forEachIfErrorDoNotCallFunction() {
  let called = {
    contents: []
  };
  Stdlib_Result.forEach({
    TAG: "Error",
    _0: 3
  }, i => {
    called.contents.push(i);
  });
  Test.run([
    [
      "Stdlib_ResultTests.res",
      17,
      22,
      63
    ],
    "forEach: if error, do not call function"
  ], called.contents, eq, []);
}

forEachIfErrorDoNotCallFunction();

Test.run([
  [
    "Stdlib_ResultTests.res",
    25,
    20,
    48
  ],
  "mapError: if ok, return it"
], Stdlib_Result.mapError({
  TAG: "Ok",
  _0: 5
}, i => i * 3 | 0), eq, {
  TAG: "Ok",
  _0: 5
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    28,
    13,
    42
  ],
  "mapError: if error, apply f"
], Stdlib_Result.mapError({
  TAG: "Error",
  _0: 5
}, i => i * 3 | 0), eq, {
  TAG: "Error",
  _0: 15
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    34,
    20,
    25
  ],
  "all"
], Stdlib_Result.all([]), eq, {
  TAG: "Ok",
  _0: []
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    35,
    20,
    25
  ],
  "all"
], Stdlib_Result.all([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Ok",
    _0: 2
  },
  {
    TAG: "Ok",
    _0: 3
  }
]), eq, {
  TAG: "Ok",
  _0: [
    1,
    2,
    3
  ]
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    36,
    20,
    25
  ],
  "all"
], Stdlib_Result.all([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Error",
    _0: 2
  }
]), eq, {
  TAG: "Error",
  _0: 2
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    37,
    20,
    25
  ],
  "all"
], Stdlib_Result.all2([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Ok",
    _0: 2
  }
]), eq, {
  TAG: "Ok",
  _0: [
    1,
    2
  ]
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    38,
    20,
    25
  ],
  "all"
], Stdlib_Result.all2([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Error",
    _0: 2
  }
]), eq, {
  TAG: "Error",
  _0: 2
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    39,
    20,
    25
  ],
  "all"
], Stdlib_Result.all3([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Ok",
    _0: 2
  },
  {
    TAG: "Ok",
    _0: 3
  }
]), eq, {
  TAG: "Ok",
  _0: [
    1,
    2,
    3
  ]
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    40,
    20,
    25
  ],
  "all"
], Stdlib_Result.all3([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Error",
    _0: 2
  },
  {
    TAG: "Ok",
    _0: 3
  }
]), eq, {
  TAG: "Error",
  _0: 2
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    41,
    20,
    25
  ],
  "all"
], Stdlib_Result.all4([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Ok",
    _0: 2
  },
  {
    TAG: "Ok",
    _0: 3
  },
  {
    TAG: "Ok",
    _0: 4
  }
]), eq, {
  TAG: "Ok",
  _0: [
    1,
    2,
    3,
    4
  ]
});

Test.run([
  [
    "Stdlib_ResultTests.res",
    42,
    20,
    25
  ],
  "all"
], Stdlib_Result.all4([
  {
    TAG: "Ok",
    _0: 1
  },
  {
    TAG: "Error",
    _0: 2
  },
  {
    TAG: "Ok",
    _0: 3
  },
  {
    TAG: "Ok",
    _0: 4
  }
]), eq, {
  TAG: "Error",
  _0: 2
});

export {
  eq,
  forEachIfOkCallFunction,
  forEachIfErrorDoNotCallFunction,
}
/*  Not a pure module */
