5

I am trying to run test cases in sol-unit for Solidity, but when I compile my code with solc compiler I get an error. I don't think the error is critical, but there is very little material on net about it:

demotest.sol:13:9: Error: Member "assertNotEqual" not found or not visible
after argument-dependent lookup in uint256
demo.getX().assertNotEqual(TEST_VAL, "Values are not equal");

contract Demo {

    uint _x = 0;

    function setX(uint x){
        _x = x;
    }

    function getX() constant returns (uint x){
        return _x;
    }
}
import "./Demo.sol";

contract DemoTest is Demo {

    uint constant TEST_VAL = 55;

    // Test method starts with 'test' and will thus be recognized (2).
    function testSetX(){
        Demo demo = new Demo();
        demo.setX(TEST_VAL);

        // Assert methods bound to type. Assertions will automatically fire off a test event (3).
        demo.getX().assertNotEqual(TEST_VAL, "Values are not equal");
    }
}
1

getX() returns a uint which does not have a member called assertNotEqual. You are probably missing a library that contains that function and the statement that adds the library to all uint types: using LibraryName for uint.

0

I use Assert.sol as:

Assert.notEqual(Value, ComparativeValue, Message) and it works at leats for equal and notEqual methods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.