Add Unit Test
This commit is contained in:
parent
5286c07296
commit
3304c1a738
7 changed files with 44 additions and 14 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
data/*
|
data/*
|
||||||
node_modules/*
|
node_modules/*
|
||||||
*.json
|
*.json
|
||||||
|
bin/*
|
||||||
|
build/*
|
13
Test.eth
13
Test.eth
|
@ -1,13 +0,0 @@
|
||||||
pragma solidity ^0.4.18;
|
|
||||||
|
|
||||||
contract Test {
|
|
||||||
int256 a = 0;
|
|
||||||
|
|
||||||
function set(int256 n) public {
|
|
||||||
a += n;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get() public constant returns(int256) {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
13
contracts/HelloEthSalon.sol
Normal file
13
contracts/HelloEthSalon.sol
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
pragma solidity ^0.4.4;
|
||||||
|
|
||||||
|
contract HelloEthSalon {
|
||||||
|
string message = "I know smart contract testing!!";
|
||||||
|
|
||||||
|
function HelloEthSalon() {
|
||||||
|
// constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetMessage() returns (string) {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
5
migrations/1_initial_migration.js
Normal file
5
migrations/1_initial_migration.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
var HelloEthSalon = artifacts.require('./HelloEthSalon.sol');
|
||||||
|
|
||||||
|
module.exports = function(deployer) {
|
||||||
|
deployer.deploy(HelloEthSalon);
|
||||||
|
};
|
9
test/hello_eth_salon.js
Normal file
9
test/hello_eth_salon.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
var HelloEthSalon = artifacts.require("./HelloEthSalon.sol");
|
||||||
|
|
||||||
|
contract("HelloEthSalon:GetMessage", function (accounts) {
|
||||||
|
it("should return a correct string", async function () {
|
||||||
|
const contract = await HelloEthSalon.deployed();
|
||||||
|
const result = await contract.GetMessage.call();
|
||||||
|
assert.isTrue(result === "I know smart contract testing!!");
|
||||||
|
});
|
||||||
|
});
|
4
truffle-config.js
Normal file
4
truffle-config.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
// See <http://truffleframework.com/docs/advanced/configuration>
|
||||||
|
// to customize your Truffle configuration!
|
||||||
|
};
|
10
truffle.js
Normal file
10
truffle.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module.exports = {
|
||||||
|
networks: {
|
||||||
|
development: {
|
||||||
|
host: "localhost",
|
||||||
|
port: 8545,
|
||||||
|
network_id: "*", // Match any network id
|
||||||
|
gas: 4700000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue