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
fd165902
Commit
fd165902
authored
Oct 08, 2019
by
0mkar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update remix-tests unit tests
parent
c5955640
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
37 deletions
+23
-37
package-lock.json
remix-tests/package-lock.json
+0
-0
simple_storage_test.sol
remix-tests/tests/examples_1/simple_storage_test.sol
+7
-9
simple_storage_test.sol
remix-tests/tests/examples_2/simple_storage_test.sol
+4
-7
simple_string_test.sol
remix-tests/tests/examples_3/simple_string_test.sol
+2
-6
testRunner.ts
remix-tests/tests/testRunner.ts
+10
-15
No files found.
remix-tests/package-lock.json
View file @
fd165902
This source diff could not be displayed because it is too large. You can
view the blob
instead.
remix-tests/tests/examples_1/simple_storage_test.sol
View file @
fd165902
...
@@ -8,22 +8,20 @@ contract MyTest {
...
@@ -8,22 +8,20 @@ contract MyTest {
foo = new SimpleStorage();
foo = new SimpleStorage();
}
}
function initialValueShouldBe100() public view returns (bool) {
function initialValueShouldBe100() public returns (bool) {
//return Assert.equal(foo.get(), 100, "initial value is not correct");
return Assert.equal(foo.get(), 100, "initial value is not correct");
return foo.get() == 100;
}
}
function initialValueShouldBe200() public view returns (bool) {
function initialValueShouldNotBe200() public returns (bool) {
//return Assert.equal(foo.get(), 200, "initial value is not correct");
return Assert.notEqual(foo.get(), 200, "initial value is not correct");
return foo.get() == 200;
}
}
function shouldTriggerOneFail() public {
function shouldTriggerOneFail() public {
Assert.equal(uint(1), uint(2), "
the
test 1 fails");
Assert.equal(uint(1), uint(2), "
uint
test 1 fails");
Assert.
equal(uint(1), uint(2), "the test 2 fail
s");
Assert.
notEqual(uint(1), uint(2), "uint test 2 passe
s");
}
}
function shouldTriggerOnePass() public {
function shouldTriggerOnePass() public {
Assert.equal(uint(1), uint(1), "
the test 3 fail
s");
Assert.equal(uint(1), uint(1), "
uint test 3 passe
s");
}
}
}
}
remix-tests/tests/examples_2/simple_storage_test.sol
View file @
fd165902
...
@@ -13,14 +13,11 @@ contract MyTest {
...
@@ -13,14 +13,11 @@ contract MyTest {
i += 1;
i += 1;
}
}
function initialValueShouldBe100() public view returns (bool) {
function initialValueShouldBe200() public returns (bool) {
//return Assert.equal(foo.get(), 100, "initial value is not correct");
return Assert.equal(foo.get(), 200, "initial value is not correct");
return foo.get() == 100;
}
}
function initialValueShouldBe200() public view returns (bool) {
function valueShouldBe100() public returns (bool) {
//return Assert.equal(foo.get(), 200, "initial value is not correct");
return Assert.equal(foo.get(), 100, "value is not correct after first execution");
return foo.get() == 200;
}
}
}
}
remix-tests/tests/examples_3/simple_string_test.sol
View file @
fd165902
...
@@ -8,15 +8,11 @@ contract StringTest {
...
@@ -8,15 +8,11 @@ contract StringTest {
foo = new SimpleString();
foo = new SimpleString();
}
}
function initialValueShouldBeHello() public returns (bool) {
function initialValueShouldBeHello
World
() public returns (bool) {
return Assert.equal(foo.get(), "Hello world!", "initial value is not correct");
return Assert.equal(foo.get(), "Hello world!", "initial value is not correct");
}
}
function valueShouldNotBeHelloWordl() public returns (bool) {
function valueShouldNotBeHelloWordl() public returns (bool) {
return Assert.notEqual(foo.get(), "Hello wordl!", "value should not be hello world");
return Assert.notEqual(foo.get(), "Hello wordl!", "value should not be hello wordl");
}
function valueShouldBeHelloWorld() public returns (bool) {
return Assert.equal(foo.get(), "Hello wordl!", "initial value is not correct");
}
}
}
}
remix-tests/tests/testRunner.ts
View file @
fd165902
...
@@ -108,22 +108,22 @@ describe('testRunner', () => {
...
@@ -108,22 +108,22 @@ describe('testRunner', () => {
after
(()
=>
{
tests
=
[]
})
after
(()
=>
{
tests
=
[]
})
it
(
'should
1
passing test'
,
function
()
{
it
(
'should
have 3
passing test'
,
function
()
{
assert
.
equal
(
results
.
passingNum
,
2
)
assert
.
equal
(
results
.
passingNum
,
3
)
})
})
it
(
'should 1 failing test'
,
function
()
{
it
(
'should
have
1 failing test'
,
function
()
{
assert
.
equal
(
results
.
failureNum
,
2
)
assert
.
equal
(
results
.
failureNum
,
1
)
})
})
it
(
'should return 6 messages'
,
function
()
{
it
(
'should return 6 messages'
,
function
()
{
deepEqualExcluding
(
tests
,
[
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
'tests/examples_1/simple_storage_test.sol'
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
'tests/examples_1/simple_storage_test.sol'
},
{
type
:
'testFailure'
,
value
:
'Should trigger one fail'
,
context
:
'MyTest'
,
errMsg
:
'the test 1 fails'
},
{
type
:
'testPass'
,
value
:
'Should trigger one pass'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'Should trigger one pass'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should be100'
,
context
:
'MyTest'
},
{
type
:
'testFailure'
,
value
:
'Should trigger one fail'
,
errMsg
:
'uint test 1 fails'
,
context
:
'MyTest'
},
{
type
:
'testFailure'
,
value
:
'Initial value should be200'
,
context
:
'MyTest'
,
errMsg
:
'function returned false'
}
{
type
:
'testPass'
,
value
:
'Initial value should not be200'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should be100'
,
context
:
'MyTest'
}
],
[
'time'
])
],
[
'time'
])
})
})
})
})
...
@@ -139,7 +139,7 @@ describe('testRunner', () => {
...
@@ -139,7 +139,7 @@ describe('testRunner', () => {
after
(()
=>
{
tests
=
[]
})
after
(()
=>
{
tests
=
[]
})
it
(
'should 2 passing tests'
,
function
()
{
it
(
'should
have
2 passing tests'
,
function
()
{
assert
.
equal
(
results
.
passingNum
,
2
)
assert
.
equal
(
results
.
passingNum
,
2
)
})
})
...
@@ -151,7 +151,7 @@ describe('testRunner', () => {
...
@@ -151,7 +151,7 @@ describe('testRunner', () => {
deepEqualExcluding
(
tests
,
[
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
'tests/examples_2/simple_storage_test.sol'
},
{
type
:
'contract'
,
value
:
'MyTest'
,
filename
:
'tests/examples_2/simple_storage_test.sol'
},
{
type
:
'testPass'
,
value
:
'
Initial v
alue should be100'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'
V
alue should be100'
,
context
:
'MyTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should be200'
,
context
:
'MyTest'
}
{
type
:
'testPass'
,
value
:
'Initial value should be200'
,
context
:
'MyTest'
}
],
[
'time'
])
],
[
'time'
])
})
})
...
@@ -173,17 +173,12 @@ describe('testRunner', () => {
...
@@ -173,17 +173,12 @@ describe('testRunner', () => {
assert
.
equal
(
results
.
passingNum
,
2
)
assert
.
equal
(
results
.
passingNum
,
2
)
})
})
it
(
'should 1 failing tests'
,
function
()
{
assert
.
equal
(
results
.
failureNum
,
1
)
})
it
(
'should return 4 messages'
,
function
()
{
it
(
'should return 4 messages'
,
function
()
{
deepEqualExcluding
(
tests
,
[
deepEqualExcluding
(
tests
,
[
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'accountList'
,
value
:
accounts
},
{
type
:
'contract'
,
value
:
'StringTest'
,
filename
:
'tests/examples_3/simple_string_test.sol'
},
{
type
:
'contract'
,
value
:
'StringTest'
,
filename
:
'tests/examples_3/simple_string_test.sol'
},
{
type
:
'testFailure'
,
value
:
'Value should be hello world'
,
context
:
'StringTest'
,
"errMsg"
:
"initial value is not correct"
},
{
type
:
'testPass'
,
value
:
'Value should not be hello wordl'
,
context
:
'StringTest'
},
{
type
:
'testPass'
,
value
:
'Value should not be hello wordl'
,
context
:
'StringTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should be hello
'
,
context
:
'StringTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should be hello
world'
,
context
:
'StringTest'
}
],
[
'time'
])
],
[
'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