You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.9 KiB
102 lines
2.9 KiB
7 years ago
|
module.exports = `
|
||
7 years ago
|
pragma solidity ^0.4.7;
|
||
|
|
||
|
library Assert {
|
||
|
|
||
7 years ago
|
event AssertionEvent(
|
||
7 years ago
|
bool passed,
|
||
7 years ago
|
string message
|
||
|
);
|
||
|
|
||
7 years ago
|
function ok(bool a, string message) public returns (bool result) {
|
||
|
result = a;
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
function equal(uint a, uint b, string message) public returns (bool result) {
|
||
|
result = (a == b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
function equal(int a, int b, string message) public returns (bool result) {
|
||
|
result = (a == b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
|
function equal(bool a, bool b, string message) public returns (bool result) {
|
||
|
result = (a == b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
// TODO: only for certain versions of solc
|
||
7 years ago
|
//function equal(fixed a, fixed b, string message) public returns (bool result) {
|
||
|
// result = (a == b);
|
||
6 years ago
|
// emit AssertionEvent(result, message);
|
||
7 years ago
|
//}
|
||
|
|
||
7 years ago
|
// TODO: only for certain versions of solc
|
||
7 years ago
|
//function equal(ufixed a, ufixed b, string message) public returns (bool result) {
|
||
|
// result = (a == b);
|
||
6 years ago
|
// emit AssertionEvent(result, message);
|
||
7 years ago
|
//}
|
||
|
|
||
|
function equal(address a, address b, string message) public returns (bool result) {
|
||
|
result = (a == b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
|
function equal(bytes32 a, bytes32 b, string message) public returns (bool result) {
|
||
|
result = (a == b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
6 years ago
|
function equal(string a, string b, string message) public returns (bool result) {
|
||
|
result = (keccak256(a) == keccak256(b));
|
||
|
AssertionEvent(result, message);
|
||
|
}
|
||
7 years ago
|
|
||
|
function notEqual(uint a, uint b, string message) public returns (bool result) {
|
||
|
result = (a != b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
7 years ago
|
function notEqual(int a, int b, string message) public returns (bool result) {
|
||
|
result = (a != b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
|
function notEqual(bool a, bool b, string message) public returns (bool result) {
|
||
|
result = (a != b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
|
// TODO: only for certain versions of solc
|
||
|
//function notEqual(fixed a, fixed b, string message) public returns (bool result) {
|
||
|
// result = (a != b);
|
||
6 years ago
|
// emit AssertionEvent(result, message);
|
||
7 years ago
|
//}
|
||
|
|
||
|
// TODO: only for certain versions of solc
|
||
|
//function notEqual(ufixed a, ufixed b, string message) public returns (bool result) {
|
||
|
// result = (a != b);
|
||
6 years ago
|
// emit AssertionEvent(result, message);
|
||
7 years ago
|
//}
|
||
|
|
||
|
function notEqual(address a, address b, string message) public returns (bool result) {
|
||
|
result = (a != b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
|
function notEqual(bytes32 a, bytes32 b, string message) public returns (bool result) {
|
||
|
result = (a != b);
|
||
6 years ago
|
emit AssertionEvent(result, message);
|
||
7 years ago
|
}
|
||
|
|
||
6 years ago
|
function notEqual(string a, string b, string message) public returns (bool result) {
|
||
|
result = (keccak256(a) != keccak256(b));
|
||
|
AssertionEvent(result, message);
|
||
|
}
|
||
7 years ago
|
|
||
7 years ago
|
}
|
||
7 years ago
|
`
|