Skip to content

Commit

Permalink
Fix and test !=
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinsch committed Feb 27, 2018
1 parent 7ce6529 commit 05e2bee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/IRGen/IULIAFunction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ extension IULIAFunction {
case .openAngledBracket: return "lt(\(lhs), \(rhs))"
case .greaterThanOrEqual: return "ge(\(lhs), \(rhs))"
case .doubleEqual: return "eq(\(lhs), \(rhs))"
case .notEqual: return "neq(\(lhs), \(rhs))"
case .notEqual: return "iszero(eq(\(lhs), \(rhs)))"
default: fatalError()
}
}
Expand Down
8 changes: 8 additions & 0 deletions Tests/BehaviorTests/tests/string/string.flint
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,13 @@ StringContract :: (any) {

return false
}

public func isNotEqual(other: String) -> Bool {
if s != other {
return true
}

return false
}
}

9 changes: 7 additions & 2 deletions Tests/BehaviorTests/tests/string/test/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ contract(config.contractName, function(accounts) {
assert.equal(web3.toUtf8(t.valueOf()), "hello");
});

it("should be possible to compare string", async function() {
it("should be possible to compare strings", async function() {
const instance = await Contract.deployed();

await instance.set("hello");
let t = await instance.isEqual("hello");

let t = await instance.isEqual("hello");
assert.equal(t.valueOf(), 1);

t = await instance.isEqual("hell");
assert.equal(t.valueOf(), 0);

t = await instance.isNotEqual("hello");
assert.equal(t.valueOf(), 0);

t = await instance.isNotEqual("hell");
assert.equal(t.valueOf(), 1);
});
});

Expand Down

0 comments on commit 05e2bee

Please sign in to comment.