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
339f3ad5
Commit
339f3ad5
authored
Nov 15, 2018
by
LianaHus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
constant -> view
parent
fcc623bf
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
29 deletions
+29
-29
simple_storage2_test.sol
remix-tests/examples/simple_storage2_test.sol
+2
-2
tests.sol.js
remix-tests/sol/tests.sol.js
+8
-8
simple_storage_test.sol
remix-tests/tests/examples_1/simple_storage_test.sol
+2
-2
simple_storage_test.sol
remix-tests/tests/examples_2/simple_storage_test.sol
+2
-2
simple_string_test.sol
remix-tests/tests/examples_3/simple_string_test.sol
+3
-3
SafeMath_test.sol
remix-tests/tests/examples_4/SafeMath_test.sol
+4
-4
number_test.sol
remix-tests/tests/number/number_test.sol
+8
-8
No files found.
remix-tests/examples/simple_storage2_test.sol
View file @
339f3ad5
...
@@ -17,11 +17,11 @@ contract MyTest2 {
...
@@ -17,11 +17,11 @@ contract MyTest2 {
i += 1;
i += 1;
}
}
function initialValueShouldBe100() public
constant
returns (bool) {
function initialValueShouldBe100() public
view
returns (bool) {
return Assert.equal(foo.get(), 100, "initial value is not correct");
return Assert.equal(foo.get(), 100, "initial value is not correct");
}
}
function initialValueShouldBe200() public
constant
returns (bool) {
function initialValueShouldBe200() public
view
returns (bool) {
return Assert.equal(foo.get(), 200, "initial value is not correct");
return Assert.equal(foo.get(), 200, "initial value is not correct");
}
}
...
...
remix-tests/sol/tests.sol.js
View file @
339f3ad5
...
@@ -98,17 +98,17 @@ library Assert {
...
@@ -98,17 +98,17 @@ library Assert {
}
}
/*----------------- Greater than --------------------*/
/*----------------- Greater than --------------------*/
function greaterThan(uint a, uint b, string message) public
constant
returns (bool result) {
function greaterThan(uint a, uint b, string message) public
view
returns (bool result) {
result = (a > b);
result = (a > b);
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
function greaterThan(int a, int b, string message) public
constant
returns (bool result) {
function greaterThan(int a, int b, string message) public
view
returns (bool result) {
result = (a > b);
result = (a > b);
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
// TODO: safely compare between uint and int
// TODO: safely compare between uint and int
function greaterThan(uint a, int b, string message) public
constant
returns (bool result) {
function greaterThan(uint a, int b, string message) public
view
returns (bool result) {
if(b < int(0)) {
if(b < int(0)) {
// int is negative uint "a" always greater
// int is negative uint "a" always greater
result = true;
result = true;
...
@@ -117,7 +117,7 @@ library Assert {
...
@@ -117,7 +117,7 @@ library Assert {
}
}
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
function greaterThan(int a, uint b, string message) public
constant
returns (bool result) {
function greaterThan(int a, uint b, string message) public
view
returns (bool result) {
if(a < int(0)) {
if(a < int(0)) {
// int is negative uint "b" always greater
// int is negative uint "b" always greater
result = false;
result = false;
...
@@ -127,17 +127,17 @@ library Assert {
...
@@ -127,17 +127,17 @@ library Assert {
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
/*----------------- Lesser than --------------------*/
/*----------------- Lesser than --------------------*/
function lesserThan(uint a, uint b, string message) public
constant
returns (bool result) {
function lesserThan(uint a, uint b, string message) public
view
returns (bool result) {
result = (a < b);
result = (a < b);
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
function lesserThan(int a, int b, string message) public
constant
returns (bool result) {
function lesserThan(int a, int b, string message) public
view
returns (bool result) {
result = (a < b);
result = (a < b);
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
// TODO: safely compare between uint and int
// TODO: safely compare between uint and int
function lesserThan(uint a, int b, string message) public
constant
returns (bool result) {
function lesserThan(uint a, int b, string message) public
view
returns (bool result) {
if(b < int(0)) {
if(b < int(0)) {
// int is negative int "b" always lesser
// int is negative int "b" always lesser
result = false;
result = false;
...
@@ -147,7 +147,7 @@ library Assert {
...
@@ -147,7 +147,7 @@ library Assert {
emit AssertionEvent(result, message);
emit AssertionEvent(result, message);
}
}
function lesserThan(int a, uint b, string message) public
constant
returns (bool result) {
function lesserThan(int a, uint b, string message) public
view
returns (bool result) {
if(a < int(0)) {
if(a < int(0)) {
// int is negative int "a" always lesser
// int is negative int "a" always lesser
result = true;
result = true;
...
...
remix-tests/tests/examples_1/simple_storage_test.sol
View file @
339f3ad5
...
@@ -8,12 +8,12 @@ contract MyTest {
...
@@ -8,12 +8,12 @@ contract MyTest {
foo = new SimpleStorage();
foo = new SimpleStorage();
}
}
function initialValueShouldBe100() public
constant
returns (bool) {
function initialValueShouldBe100() public
view
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;
return foo.get() == 100;
}
}
function initialValueShouldBe200() public
constant
returns (bool) {
function initialValueShouldBe200() public
view
returns (bool) {
//return Assert.equal(foo.get(), 200, "initial value is not correct");
//return Assert.equal(foo.get(), 200, "initial value is not correct");
return foo.get() == 200;
return foo.get() == 200;
}
}
...
...
remix-tests/tests/examples_2/simple_storage_test.sol
View file @
339f3ad5
...
@@ -13,12 +13,12 @@ contract MyTest {
...
@@ -13,12 +13,12 @@ contract MyTest {
i += 1;
i += 1;
}
}
function initialValueShouldBe100() public
constant
returns (bool) {
function initialValueShouldBe100() public
view
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;
return foo.get() == 100;
}
}
function initialValueShouldBe200() public
constant
returns (bool) {
function initialValueShouldBe200() public
view
returns (bool) {
//return Assert.equal(foo.get(), 200, "initial value is not correct");
//return Assert.equal(foo.get(), 200, "initial value is not correct");
return foo.get() == 200;
return foo.get() == 200;
}
}
...
...
remix-tests/tests/examples_3/simple_string_test.sol
View file @
339f3ad5
...
@@ -8,15 +8,15 @@ contract StringTest {
...
@@ -8,15 +8,15 @@ contract StringTest {
foo = new SimpleString();
foo = new SimpleString();
}
}
function initialValueShouldBeHello() public
constant
returns (bool) {
function initialValueShouldBeHello() public
view
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 valueShouldNotBeHelloWorld() public
constant
returns (bool) {
function valueShouldNotBeHelloWorld() public
viewview
returns (bool) {
return Assert.notEqual(foo.get(), "Hello wordl!", "initial value is not correct");
return Assert.notEqual(foo.get(), "Hello wordl!", "initial value is not correct");
}
}
function valueShouldBeHelloWorld() public
constant
returns (bool) {
function valueShouldBeHelloWorld() public
view
returns (bool) {
return Assert.equal(foo.get(), "Hello wordl!", "initial value is not correct");
return Assert.equal(foo.get(), "Hello wordl!", "initial value is not correct");
}
}
}
}
remix-tests/tests/examples_4/SafeMath_test.sol
View file @
339f3ad5
...
@@ -10,7 +10,7 @@ contract SafeMathTest {
...
@@ -10,7 +10,7 @@ contract SafeMathTest {
safemathproxy = new SafeMathProxy();
safemathproxy = new SafeMathProxy();
}
}
function unsafeMultiplicationShouldOverflow() public
constant
returns (bool) {
function unsafeMultiplicationShouldOverflow() public
view
returns (bool) {
uint256 a = 4;
uint256 a = 4;
uint256 b = 2 ** 256 - 1;
uint256 b = 2 ** 256 - 1;
return Assert.equal(
return Assert.equal(
...
@@ -20,7 +20,7 @@ contract SafeMathTest {
...
@@ -20,7 +20,7 @@ contract SafeMathTest {
);
);
}
}
function safeMultiplicationShouldRevert() public
constant
returns (bool) {
function safeMultiplicationShouldRevert() public
view
returns (bool) {
uint256 a = 4;
uint256 a = 4;
uint256 b = 2 ** 256 - 1;
uint256 b = 2 ** 256 - 1;
return Assert.equal(
return Assert.equal(
...
@@ -30,7 +30,7 @@ contract SafeMathTest {
...
@@ -30,7 +30,7 @@ contract SafeMathTest {
);
);
}
}
function safeDivisionByZeroShouldRevert() public
constant
returns (bool) {
function safeDivisionByZeroShouldRevert() public
view
returns (bool) {
uint256 a = 4;
uint256 a = 4;
uint256 b = 0;
uint256 b = 0;
return Assert.equal(
return Assert.equal(
...
@@ -40,7 +40,7 @@ contract SafeMathTest {
...
@@ -40,7 +40,7 @@ contract SafeMathTest {
);
);
}
}
function unsafeSubtractShouldUnderflow() public
constant
returns (bool) {
function unsafeSubtractShouldUnderflow() public
view
returns (bool) {
uint256 a = 0;
uint256 a = 0;
uint256 b = a - 1;
uint256 b = a - 1;
return Assert.equal(
return Assert.equal(
...
...
remix-tests/tests/number/number_test.sol
View file @
339f3ad5
...
@@ -3,36 +3,36 @@ pragma solidity ^0.4.24;
...
@@ -3,36 +3,36 @@ pragma solidity ^0.4.24;
contract IntegerTest {
contract IntegerTest {
// GREATER THAN [>] tests
// GREATER THAN [>] tests
function _2_shouldBeGreaterThan_1() public
constant
returns (bool) {
function _2_shouldBeGreaterThan_1() public
view
returns (bool) {
return Assert.greaterThan(uint(2), uint(1), "2 is greater than 1");
return Assert.greaterThan(uint(2), uint(1), "2 is greater than 1");
}
}
function _0_shouldBeGreaterThan_neg_1() public
constant
returns (bool) {
function _0_shouldBeGreaterThan_neg_1() public
view
returns (bool) {
return Assert.greaterThan(uint(0), int(-1), "0 is greater than -1");
return Assert.greaterThan(uint(0), int(-1), "0 is greater than -1");
}
}
function _neg_1_shouldNotBeGreaterThan_1() public
constant
returns (bool) {
function _neg_1_shouldNotBeGreaterThan_1() public
view
returns (bool) {
return Assert.greaterThan(int(-1), uint(1), "-1 is not greater than 1");
return Assert.greaterThan(int(-1), uint(1), "-1 is not greater than 1");
}
}
function _1_shouldBeGreaterThan_neg_1() public
constant
returns (bool) {
function _1_shouldBeGreaterThan_neg_1() public
view
returns (bool) {
return Assert.greaterThan(uint(1), int(-1), "1 is greater than -1");
return Assert.greaterThan(uint(1), int(-1), "1 is greater than -1");
}
}
// LESSER THAN [<] tests
// LESSER THAN [<] tests
function _1_shouldBeLesserThan_2() public
constant
returns (bool) {
function _1_shouldBeLesserThan_2() public
view
returns (bool) {
return Assert.lesserThan(uint(1), uint(2), "1 is lesser than 2");
return Assert.lesserThan(uint(1), uint(2), "1 is lesser than 2");
}
}
function _neg_1_shouldBeLesserThan_0() public
constant
returns (bool) {
function _neg_1_shouldBeLesserThan_0() public
view
returns (bool) {
return Assert.lesserThan(int(-1), uint(0), "-1 is lesser than 0");
return Assert.lesserThan(int(-1), uint(0), "-1 is lesser than 0");
}
}
function _neg_2_shouldBeLesserThan_neg_1() public
constant
returns (bool) {
function _neg_2_shouldBeLesserThan_neg_1() public
view
returns (bool) {
return Assert.lesserThan(int(-2), int(-1), "-2 is lesser than -1");
return Assert.lesserThan(int(-2), int(-1), "-2 is lesser than -1");
}
}
function _0_shouldNotBeLesserThan_neg_1() public
constant
returns (bool) {
function _0_shouldNotBeLesserThan_neg_1() public
view
returns (bool) {
return Assert.lesserThan(uint(0), int(-1), "0 is not lesser than -1");
return Assert.lesserThan(uint(0), int(-1), "0 is not lesser than -1");
}
}
}
}
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