문자열 값이 올바른지 테스트 할 때 문제가 발생합니다. 숫자는 올바르게 어설트되며 컴파일하려고 할 때 오류 메시지를 반환하지 않습니다.구성원 동등 형을 사용할 수 없습니다 (라이브러리 Assert)
Error: Member "equal" is not available in type(library Assert) outside of storage.
Assert.equal(token.symbol(), "$", "The symbol of the token should be $");
^----------^
Compiliation failed. See above.
Token.sol TestToken.sol이
pragma solidity ^0.4.8;
// Framework libraries
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
// Custom libraries and contracts
import "../contracts/Token.sol";
contract TestToken {
function testExchangeRate() {
Token token = new Token(500, "Dollar", "$");
uint256 expected = 500;
Assert.equal(token.exchangeRate(), expected, "The exchange rate should be 500 tokens for 1 ETH");
}
function testSymbol() {
Token token = new Token(500, "Dollar", "$");
Assert.equal(token.symbol(), "$", "The symbol of the token should be $");
}
}
이유는 무엇입니까
pragma solidity ^0.4.8;
contract Token {
/* The amount of tokens a person will get for 1 ETH */
uint256 public exchangeRate;
/* The name of the token */
string public name;
/* The address which controls the token */
address public owner;
/* The symbol of the token */
string public symbol;
/* The balances of all registered addresses */
mapping (address => uint256) balances;
/* Token constructor */
function Token(uint256 _exchangeRate, string _name, string _symbol) {
exchangeRate = _exchangeRate;
name = _name;
owner = msg.sender;
symbol = _symbol;
}
function getBalance(address account) returns (uint256 balance) {
return balances[account];
}
}
: 나는 문자열을 주장 할 때 그러나, 다음과 같은 오류 메시지를 반환 그것은 어떻게되고 어떻게 해결합니까?
아마도 도움이 될 수 있습니까? http://ethereum.stackexchange.com/q/1701 – default
이 주제에 관한 뉴스? –