// Generated by purs version 0.12.5
"use strict";
var Control_Bind = require("../Control.Bind/index.js");
var Control_Monad_Error_Class = require("../Control.Monad.Error.Class/index.js");
var Data_Either = require("../Data.Either/index.js");
var Data_Eq = require("../Data.Eq/index.js");
var Data_Function = require("../Data.Function/index.js");
var Data_Show = require("../Data.Show/index.js");
var Effect_Aff = require("../Effect.Aff/index.js");
var Effect_Exception = require("../Effect.Exception/index.js");
var Test_Unit = require("../Test.Unit/index.js");
var expectFailure = function (reason) {
    return function (t) {
        return Control_Bind.bind(Effect_Aff.bindAff)(Effect_Aff.attempt(t))(function (v) {
            return Data_Either.either(Data_Function["const"](Test_Unit.success))(Data_Function["const"](Test_Unit.failure(reason)))(v);
        });
    };
};
var equal$prime = function (dictEq) {
    return function (reason) {
        return function (expected) {
            return function (actual) {
                var $14 = Data_Eq.eq(dictEq)(expected)(actual);
                if ($14) {
                    return Test_Unit.success;
                };
                return Test_Unit.failure(reason);
            };
        };
    };
};
var equal = function (dictEq) {
    return function (dictShow) {
        return function (expected) {
            return function (actual) {
                var $15 = Data_Eq.eq(dictEq)(expected)(actual);
                if ($15) {
                    return Test_Unit.success;
                };
                return Test_Unit.failure("expected " + (Data_Show.show(dictShow)(expected) + (", got " + Data_Show.show(dictShow)(actual))));
            };
        };
    };
};
var equal$prime$prime = function (dictEq) {
    return function (dictShow) {
        return function (name) {
            return function (a) {
                return function (b) {
                    return Control_Monad_Error_Class.catchError(Effect_Aff.monadErrorAff)(equal(dictEq)(dictShow)(a)(b))(function ($20) {
                        return Control_Monad_Error_Class.throwError(Effect_Aff.monadThrowAff)(Effect_Exception.error((function (v) {
                            return name + " " + v;
                        })(Effect_Exception.message($20))));
                    });
                };
            };
        };
    };
};
var shouldEqual = function (dictEq) {
    return function (dictShow) {
        return Data_Function.flip(equal(dictEq)(dictShow));
    };
};
var assertFalse = function (v) {
    return function (v1) {
        if (!v1) {
            return Test_Unit.success;
        };
        if (v1) {
            return Test_Unit.failure(v);
        };
        throw new Error("Failed pattern match at Test.Unit.Assert (line 26, column 1 - line 26, column 41): " + [ v.constructor.name, v1.constructor.name ]);
    };
};
var assert = function (v) {
    return function (v1) {
        if (v1) {
            return Test_Unit.success;
        };
        if (!v1) {
            return Test_Unit.failure(v);
        };
        throw new Error("Failed pattern match at Test.Unit.Assert (line 20, column 1 - line 20, column 36): " + [ v.constructor.name, v1.constructor.name ]);
    };
};
module.exports = {
    assert: assert,
    assertFalse: assertFalse,
    expectFailure: expectFailure,
    equal: equal,
    "equal'": equal$prime,
    shouldEqual: shouldEqual
};
