title: How to test smart contract with cross-contract invoke using truffle?
body: <p>I have two contract, I write in in one file, named Sum.sol. The sum contract invoke Add contract. I just want to test cross-contract invoking. If I didn't put the two contract in one file, The compile of Sum using truffle would fail. But when I do the test, the result is so weird. I don't know how this happened.</p>
  
  <pre><code>pragma solidity ^0.4.6;
  contract Add{
    function sum(uint x, uint y) returns(uint){
      return x+y;
    }
  }
  contract Sum{
    function func(uint x, uint y) returns(uint){
      Add add = new Add();
      uint re = add.sum(x,y);
      return re;
    }
  }
  </code></pre>
  
  <p>then I write a test for it In truffle</p>
  
  <pre><code>contract('Sum', function(accounts) {
    it("should return 5 when add 2 and 3", function() {
      var sum = Sum.deployed();
  
      return sum.func.call(2,3).then(function(res){
        assert.equal(res.valueOf(), 5, "add result is 5");
  
      });
    });
  });
  </code></pre>
  
  <p>And test it using truffle, then, the results is:</p>
  
  <pre><code>Compiling Sum.sol...
  
  
    Contract: Sum
      1) should return 5 when add 2 and 3
      &gt; No events were emitted
  
  
    0 passing (455ms)
    1 failing
  
    1) Contract: Sum should return 5 when add 2 and 3:
       AssertionError: add result is 5: expected   '9.1735649321334958107552852973512799782292704141468709142420585807991067901952e+76' to equal 5
        at /Users/maiffany/testcoverage/test/add.js:6:14
        at process._tickDomainCallback         (internal/process/next_tick.js:129:7)
  </code></pre>