Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
4812efca
Commit
4812efca
authored
Aug 20, 2020
by
aniket-engg
Committed by
Aniket
Aug 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bytes32 for equal and notEqual
parent
30a56149
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
12 deletions
+52
-12
tests.sol.ts
libs/remix-tests/sol/tests.sol.ts
+9
-2
assertionEvents.ts
libs/remix-tests/src/assertionEvents.ts
+4
-0
assert_equal_test.sol
libs/remix-tests/tests/examples_0/assert_equal_test.sol
+13
-0
assert_notEqual_test.sol
libs/remix-tests/tests/examples_0/assert_notEqual_test.sol
+12
-0
testRunner.spec.ts
libs/remix-tests/tests/testRunner.spec.ts
+14
-10
No files found.
libs/remix-tests/sol/tests.sol.ts
View file @
4812efca
...
...
@@ -36,6 +36,13 @@ library Assert {
address expected
);
event AssertionEventBytes32(
bool passed,
string message,
bytes32 returned,
bytes32 expected
);
function ok(bool a, string memory message) public returns (bool result) {
result = a;
emit AssertionEvent(result, message);
...
...
@@ -75,7 +82,7 @@ library Assert {
function equal(bytes32 a, bytes32 b, string memory message) public returns (bool result) {
result = (a == b);
emit AssertionEvent
(result, message
);
emit AssertionEvent
Bytes32(result, message, a, b
);
}
function equal(string memory a, string memory b, string memory message) public returns (bool result) {
...
...
@@ -117,7 +124,7 @@ library Assert {
function notEqual(bytes32 a, bytes32 b, string memory message) public returns (bool result) {
result = (a != b);
emit AssertionEvent
(result, message
);
emit AssertionEvent
Bytes32(result, message, a, b
);
}
function notEqual(string memory a, string memory b, string memory message) public returns (bool result) {
...
...
libs/remix-tests/src/assertionEvents.ts
View file @
4812efca
...
...
@@ -18,6 +18,10 @@ const assertionEvents = [
{
name
:
'AssertionEventAddress'
,
params
:
[
'bool'
,
'string'
,
'address'
,
'address'
]
},
{
name
:
'AssertionEventBytes32'
,
params
:
[
'bool'
,
'string'
,
'bytes32'
,
'bytes32'
]
}
]
...
...
libs/remix-tests/tests/examples_0/assert_equal_test.sol
View file @
4812efca
...
...
@@ -33,4 +33,16 @@ contract AssertEqualTest {
function equalAddressFailTest() public {
Assert.equal(0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, 0x1c6637567229159d1eFD45f95A6675e77727E013, "equalAddressFailTest fails");
}
function equalBytes32PassTest() public {
bytes32 e = 0x72656d6978000000000000000000000000000000000000000000000000000000;
bytes32 r = 0x72656d6978000000000000000000000000000000000000000000000000000000;
Assert.equal(r, e, "equalBytes32PassTest passes");
}
function equalBytes32FailTest() public {
bytes32 e = 0x72656d6978000000000000000000000000000000000000000000000000000000;
bytes32 r = 0x72656d6979000000000000000000000000000000000000000000000000000000;
Assert.equal(r, e, "equalBytes32FailTest fails");
}
}
\ No newline at end of file
libs/remix-tests/tests/examples_0/assert_notEqual_test.sol
View file @
4812efca
...
...
@@ -33,4 +33,16 @@ contract AssertNotEqualTest {
function notEqualAddressFailTest() public {
Assert.notEqual(0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, "notEqualAddressFailTest fails");
}
function notEqualBytes32PassTest() public {
bytes32 e = 0x72656d6978000000000000000000000000000000000000000000000000000000;
bytes32 r = 0x72656d6979000000000000000000000000000000000000000000000000000000;
Assert.notEqual(r, e, "notEqualBytes32PassTest fails");
}
function notEqualBytes32FailTest() public {
bytes32 e = 0x72656d6978000000000000000000000000000000000000000000000000000000;
bytes32 r = 0x72656d6978000000000000000000000000000000000000000000000000000000;
Assert.notEqual(r, e, "notEqualBytes32FailTest fails");
}
}
libs/remix-tests/tests/testRunner.spec.ts
View file @
4812efca
...
...
@@ -143,12 +143,12 @@ describe('testRunner', () => {
afterAll
(()
=>
{
tests
=
[]
})
it
(
'should have
4
passing test'
,
()
=>
{
assert
.
equal
(
results
.
passingNum
,
4
)
it
(
'should have
5
passing test'
,
()
=>
{
assert
.
equal
(
results
.
passingNum
,
5
)
})
it
(
'should have
4
failing test'
,
()
=>
{
assert
.
equal
(
results
.
failureNum
,
4
)
it
(
'should have
5
failing test'
,
()
=>
{
assert
.
equal
(
results
.
failureNum
,
5
)
})
it
(
'should return'
,
()
=>
{
...
...
@@ -162,7 +162,9 @@ describe('testRunner', () => {
{
type
:
'testPass'
,
value
:
'Equal bool pass test'
,
context
:
'AssertEqualTest'
},
{
type
:
'testFailure'
,
value
:
'Equal bool fail test'
,
errMsg
:
'equalBoolFailTest fails'
,
context
:
'AssertEqualTest'
,
expected
:
false
,
returned
:
true
},
{
type
:
'testPass'
,
value
:
'Equal address pass test'
,
context
:
'AssertEqualTest'
},
{
type
:
'testFailure'
,
value
:
'Equal address fail test'
,
errMsg
:
'equalAddressFailTest fails'
,
context
:
'AssertEqualTest'
,
expected
:
'0x1c6637567229159d1eFD45f95A6675e77727E013'
,
returned
:
'0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9'
}
{
type
:
'testFailure'
,
value
:
'Equal address fail test'
,
errMsg
:
'equalAddressFailTest fails'
,
context
:
'AssertEqualTest'
,
expected
:
'0x1c6637567229159d1eFD45f95A6675e77727E013'
,
returned
:
'0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9'
},
{
type
:
'testPass'
,
value
:
'Equal bytes32 pass test'
,
context
:
'AssertEqualTest'
},
{
type
:
'testFailure'
,
value
:
'Equal bytes32 fail test'
,
errMsg
:
'equalBytes32FailTest fails'
,
context
:
'AssertEqualTest'
,
expected
:
'0x72656d6978000000000000000000000000000000000000000000000000000000'
,
returned
:
'0x72656d6979000000000000000000000000000000000000000000000000000000'
}
],
[
'time'
])
})
})
...
...
@@ -178,12 +180,12 @@ describe('testRunner', () => {
afterAll
(()
=>
{
tests
=
[]
})
it
(
'should have
4
passing test'
,
()
=>
{
assert
.
equal
(
results
.
passingNum
,
4
)
it
(
'should have
5
passing test'
,
()
=>
{
assert
.
equal
(
results
.
passingNum
,
5
)
})
it
(
'should have
4
failing test'
,
()
=>
{
assert
.
equal
(
results
.
failureNum
,
4
)
it
(
'should have
5
failing test'
,
()
=>
{
assert
.
equal
(
results
.
failureNum
,
5
)
})
it
(
'should return'
,
()
=>
{
...
...
@@ -197,7 +199,9 @@ describe('testRunner', () => {
{
type
:
'testPass'
,
value
:
'Not equal bool pass test'
,
context
:
'AssertNotEqualTest'
},
{
type
:
'testFailure'
,
value
:
'Not equal bool fail test'
,
errMsg
:
'notEqualBoolFailTest fails'
,
context
:
'AssertNotEqualTest'
,
expected
:
true
,
returned
:
true
},
{
type
:
'testPass'
,
value
:
'Not equal address pass test'
,
context
:
'AssertNotEqualTest'
},
{
type
:
'testFailure'
,
value
:
'Not equal address fail test'
,
errMsg
:
'notEqualAddressFailTest fails'
,
context
:
'AssertNotEqualTest'
,
expected
:
0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9
,
returned
:
0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9
}
{
type
:
'testFailure'
,
value
:
'Not equal address fail test'
,
errMsg
:
'notEqualAddressFailTest fails'
,
context
:
'AssertNotEqualTest'
,
expected
:
0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9
,
returned
:
0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9
},
{
type
:
'testPass'
,
value
:
'Not equal bytes32 pass test'
,
context
:
'AssertNotEqualTest'
},
{
type
:
'testFailure'
,
value
:
'Not equal bytes32 fail test'
,
errMsg
:
'notEqualBytes32FailTest fails'
,
context
:
'AssertNotEqualTest'
,
expected
:
'0x72656d6978000000000000000000000000000000000000000000000000000000'
,
returned
:
'0x72656d6978000000000000000000000000000000000000000000000000000000'
}
],
[
'time'
])
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment