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
97ceaa42
Commit
97ceaa42
authored
Nov 15, 2018
by
LianaHus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added visibility specifiers
- pragma solidity 0.4.* -> 0.5.0
parent
00408be9
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
65 additions
and
64 deletions
+65
-64
simple_storage.sol
remix-tests/examples/simple_storage.sol
+1
-1
simple_storage2_test.sol
remix-tests/examples/simple_storage2_test.sol
+5
-5
simple_storage_test.sol
remix-tests/examples/simple_storage_test.sol
+5
-5
tests.sol.js
remix-tests/sol/tests.sol.js
+30
-30
simple_storage.sol
remix-tests/tests/examples_1/simple_storage.sol
+1
-1
simple_storage_test.sol
remix-tests/tests/examples_1/simple_storage_test.sol
+2
-2
simple_storage.sol
remix-tests/tests/examples_2/simple_storage.sol
+1
-1
simple_storage_test.sol
remix-tests/tests/examples_2/simple_storage_test.sol
+2
-2
simple_string.sol
remix-tests/tests/examples_3/simple_string.sol
+2
-2
simple_string_test.sol
remix-tests/tests/examples_3/simple_string_test.sol
+5
-5
number_test.sol
remix-tests/tests/number/number_test.sol
+9
-9
testRunner.js
remix-tests/tests/testRunner.js
+2
-1
No files found.
remix-tests/examples/simple_storage.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
contract SimpleStorage {
uint public storedData;
...
...
remix-tests/examples/simple_storage2_test.sol
View file @
97ceaa42
p
ragma solidity ^0.4.7
;
p
pragma solidity ^0.5.0
;
import "remix_tests.sol";
import "./simple_storage.sol";
contract MyTest2 {
SimpleStorage foo;
uint i = 0;
SimpleStorage
storage
foo;
uint
storage
i = 0;
function beforeAll() {
function beforeAll()
public
{
foo = new SimpleStorage();
}
function beforeEach() {
function beforeEach()
public
{
if (i == 1) {
foo.set(200);
}
...
...
remix-tests/examples/simple_storage_test.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
import "./simple_storage.sol";
contract MyTest {
SimpleStorage foo;
uint i = 0;
SimpleStorage
storage
foo;
uint
storage
i = 0;
function beforeAll() {
function beforeAll()
public
{
foo = new SimpleStorage();
}
function beforeEach() {
function beforeEach()
public
{
if (i == 1) {
foo.set(200);
}
...
...
remix-tests/sol/tests.sol.js
View file @
97ceaa42
module
.
exports
=
`
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
library Assert {
...
...
@@ -8,107 +8,107 @@ library Assert {
string message
);
function ok(bool a, string message) public returns (bool result) {
function ok(bool a, string me
mory me
ssage) public returns (bool result) {
result = a;
emit AssertionEvent(result, message);
}
function equal(uint a, uint b, string message) public returns (bool result) {
function equal(uint a, uint b, string me
mory me
ssage) public returns (bool result) {
result = (a == b);
emit AssertionEvent(result, message);
}
function equal(int a, int b, string message) public returns (bool result) {
function equal(int a, int b, string me
mory me
ssage) public returns (bool result) {
result = (a == b);
emit AssertionEvent(result, message);
}
function equal(bool a, bool b, string message) public returns (bool result) {
function equal(bool a, bool b, string me
mory me
ssage) public returns (bool result) {
result = (a == b);
emit AssertionEvent(result, message);
}
// TODO: only for certain versions of solc
//function equal(fixed a, fixed b, string message) public returns (bool result) {
//function equal(fixed a, fixed b, string me
mory me
ssage) public returns (bool result) {
// result = (a == b);
// emit AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function equal(ufixed a, ufixed b, string message) public returns (bool result) {
//function equal(ufixed a, ufixed b, string me
mory me
ssage) public returns (bool result) {
// result = (a == b);
// emit AssertionEvent(result, message);
//}
function equal(address a, address b, string message) public returns (bool result) {
function equal(address a, address b, string me
mory me
ssage) public returns (bool result) {
result = (a == b);
emit AssertionEvent(result, message);
}
function equal(bytes32 a, bytes32 b, string message) public returns (bool result) {
function equal(bytes32 a, bytes32 b, string me
mory me
ssage) public returns (bool result) {
result = (a == b);
emit AssertionEvent(result, message);
}
function equal(string
a, string b, string
message) public returns (bool result) {
result = (keccak256(a
) == keccak256(b
));
AssertionEvent(result, message);
function equal(string
memory a, string memory b, string memory
message) public returns (bool result) {
result = (keccak256(a
bi.encode(a)) == keccak256(abi.encode(b)
));
emit
AssertionEvent(result, message);
}
function notEqual(uint a, uint b, string message) public returns (bool result) {
function notEqual(uint a, uint b, string me
mory me
ssage) public returns (bool result) {
result = (a != b);
emit AssertionEvent(result, message);
}
function notEqual(int a, int b, string message) public returns (bool result) {
function notEqual(int a, int b, string me
mory me
ssage) public returns (bool result) {
result = (a != b);
emit AssertionEvent(result, message);
}
function notEqual(bool a, bool b, string message) public returns (bool result) {
function notEqual(bool a, bool b, string me
mory me
ssage) public returns (bool result) {
result = (a != b);
emit AssertionEvent(result, message);
}
// TODO: only for certain versions of solc
//function notEqual(fixed a, fixed b, string message) public returns (bool result) {
//function notEqual(fixed a, fixed b, string me
mory me
ssage) public returns (bool result) {
// result = (a != b);
// emit AssertionEvent(result, message);
//}
// TODO: only for certain versions of solc
//function notEqual(ufixed a, ufixed b, string message) public returns (bool result) {
//function notEqual(ufixed a, ufixed b, string me
mory me
ssage) public returns (bool result) {
// result = (a != b);
// emit AssertionEvent(result, message);
//}
function notEqual(address a, address b, string message) public returns (bool result) {
function notEqual(address a, address b, string me
mory me
ssage) public returns (bool result) {
result = (a != b);
emit AssertionEvent(result, message);
}
function notEqual(bytes32 a, bytes32 b, string message) public returns (bool result) {
function notEqual(bytes32 a, bytes32 b, string me
mory me
ssage) public returns (bool result) {
result = (a != b);
emit AssertionEvent(result, message);
}
function notEqual(string
a, string b, string
message) public returns (bool result) {
result = (keccak256(a
) != keccak256(b
));
AssertionEvent(result, message);
function notEqual(string
memory a, string memory b, string memory
message) public returns (bool result) {
result = (keccak256(a
bi.encode(a)) != keccak256(abi.encode(b)
));
emit
AssertionEvent(result, message);
}
/*----------------- Greater than --------------------*/
function greaterThan(uint a, uint b, string me
ssage) public view
returns (bool result) {
function greaterThan(uint a, uint b, string me
mory message) public
returns (bool result) {
result = (a > b);
emit AssertionEvent(result, message);
}
function greaterThan(int a, int b, string me
ssage) public view
returns (bool result) {
function greaterThan(int a, int b, string me
mory message) public
returns (bool result) {
result = (a > b);
emit AssertionEvent(result, message);
}
// TODO: safely compare between uint and int
function greaterThan(uint a, int b, string me
ssage) public view
returns (bool result) {
function greaterThan(uint a, int b, string me
mory message) public
returns (bool result) {
if(b < int(0)) {
// int is negative uint "a" always greater
result = true;
...
...
@@ -117,7 +117,7 @@ library Assert {
}
emit AssertionEvent(result, message);
}
function greaterThan(int a, uint b, string me
ssage) public view
returns (bool result) {
function greaterThan(int a, uint b, string me
mory message) public
returns (bool result) {
if(a < int(0)) {
// int is negative uint "b" always greater
result = false;
...
...
@@ -127,17 +127,17 @@ library Assert {
emit AssertionEvent(result, message);
}
/*----------------- Lesser than --------------------*/
function lesserThan(uint a, uint b, string me
ssage) public view
returns (bool result) {
function lesserThan(uint a, uint b, string me
mory message) public
returns (bool result) {
result = (a < b);
emit AssertionEvent(result, message);
}
function lesserThan(int a, int b, string me
ssage) public view
returns (bool result) {
function lesserThan(int a, int b, string me
mory message) public
returns (bool result) {
result = (a < b);
emit AssertionEvent(result, message);
}
// TODO: safely compare between uint and int
function lesserThan(uint a, int b, string me
ssage) public view
returns (bool result) {
function lesserThan(uint a, int b, string me
mory message) public
returns (bool result) {
if(b < int(0)) {
// int is negative int "b" always lesser
result = false;
...
...
@@ -147,7 +147,7 @@ library Assert {
emit AssertionEvent(result, message);
}
function lesserThan(int a, uint b, string me
ssage) public view
returns (bool result) {
function lesserThan(int a, uint b, string me
mory message) public
returns (bool result) {
if(a < int(0)) {
// int is negative int "a" always lesser
result = true;
...
...
remix-tests/tests/examples_1/simple_storage.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
contract SimpleStorage {
uint public storedData;
...
...
remix-tests/tests/examples_1/simple_storage_test.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
import "./simple_storage.sol";
contract MyTest {
SimpleStorage foo;
function beforeAll() {
function beforeAll()
public
{
foo = new SimpleStorage();
}
...
...
remix-tests/tests/examples_2/simple_storage.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
contract SimpleStorage {
uint public storedData;
...
...
remix-tests/tests/examples_2/simple_storage_test.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
import "./simple_storage.sol";
contract MyTest {
SimpleStorage foo;
uint i = 0;
function beforeEach() {
function beforeEach()
public
{
foo = new SimpleStorage();
if (i == 1) {
foo.set(200);
...
...
remix-tests/tests/examples_3/simple_string.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
contract SimpleString {
string public storedData;
...
...
@@ -6,7 +6,7 @@ contract SimpleString {
storedData = "Hello world!";
}
function get() public view returns (string retVal) {
function get() public view returns (string
memory
retVal) {
return storedData;
}
}
remix-tests/tests/examples_3/simple_string_test.sol
View file @
97ceaa42
pragma solidity ^0.
4.7
;
pragma solidity ^0.
5.0
;
import "./simple_string.sol";
contract StringTest {
SimpleString foo;
function beforeAll() {
function beforeAll()
public
{
foo = new SimpleString();
}
function initialValueShouldBeHello() public
view
returns (bool) {
function initialValueShouldBeHello() public returns (bool) {
return Assert.equal(foo.get(), "Hello world!", "initial value is not correct");
}
function valueShouldNotBeHelloWorld() public
viewview
returns (bool) {
function valueShouldNotBeHelloWorld() public returns (bool) {
return Assert.notEqual(foo.get(), "Hello wordl!", "initial value is not correct");
}
function valueShouldBeHelloWorld() public
view
returns (bool) {
function valueShouldBeHelloWorld() public returns (bool) {
return Assert.equal(foo.get(), "Hello wordl!", "initial value is not correct");
}
}
remix-tests/tests/number/number_test.sol
View file @
97ceaa42
pragma solidity ^0.
4.24
;
pragma solidity ^0.
5.0
;
contract IntegerTest {
// GREATER THAN [>] tests
function _2_shouldBeGreaterThan_1() public
view
returns (bool) {
function _2_shouldBeGreaterThan_1() public returns (bool) {
return Assert.greaterThan(uint(2), uint(1), "2 is greater than 1");
}
function _0_shouldBeGreaterThan_neg_1() public
view
returns (bool) {
function _0_shouldBeGreaterThan_neg_1() public returns (bool) {
return Assert.greaterThan(uint(0), int(-1), "0 is greater than -1");
}
function _neg_1_shouldNotBeGreaterThan_1() public
view
returns (bool) {
function _neg_1_shouldNotBeGreaterThan_1() public returns (bool) {
return Assert.greaterThan(int(-1), uint(1), "-1 is not greater than 1");
}
function _1_shouldBeGreaterThan_neg_1() public
view
returns (bool) {
function _1_shouldBeGreaterThan_neg_1() public returns (bool) {
return Assert.greaterThan(uint(1), int(-1), "1 is greater than -1");
}
// LESSER THAN [<] tests
function _1_shouldBeLesserThan_2() public
view
returns (bool) {
function _1_shouldBeLesserThan_2() public returns (bool) {
return Assert.lesserThan(uint(1), uint(2), "1 is lesser than 2");
}
function _neg_1_shouldBeLesserThan_0() public
view
returns (bool) {
function _neg_1_shouldBeLesserThan_0() public returns (bool) {
return Assert.lesserThan(int(-1), uint(0), "-1 is lesser than 0");
}
function _neg_2_shouldBeLesserThan_neg_1() public
view
returns (bool) {
function _neg_2_shouldBeLesserThan_neg_1() public returns (bool) {
return Assert.lesserThan(int(-2), int(-1), "-2 is lesser than -1");
}
function _0_shouldNotBeLesserThan_neg_1() public
view
returns (bool) {
function _0_shouldNotBeLesserThan_neg_1() public returns (bool) {
return Assert.lesserThan(uint(0), int(-1), "0 is not lesser than -1");
}
}
remix-tests/tests/testRunner.js
View file @
97ceaa42
...
...
@@ -123,9 +123,10 @@ describe('testRunner', function () {
})
it
(
'should returns 3 messages'
,
function
()
{
console
.
log
(
tests
)
assert
.
deepEqual
(
tests
,
[
{
type
:
'contract'
,
value
:
'StringTest'
,
filename
:
'simple_string_test.sol'
},
{
type
:
'testFailure'
,
value
:
'Value should be hello world'
,
time
:
1
,
context
:
'StringTest'
,
"errMsg"
:
"
function returned false
"
},
{
type
:
'testFailure'
,
value
:
'Value should be hello world'
,
time
:
1
,
context
:
'StringTest'
,
"errMsg"
:
"
initial value is not correct
"
},
{
type
:
'testPass'
,
value
:
'Value should not be hello world'
,
time
:
1
,
context
:
'StringTest'
},
{
type
:
'testPass'
,
value
:
'Initial value should be hello'
,
time
:
1
,
context
:
'StringTest'
},
])
...
...
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