-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathTestECCMultiplier.js
65 lines (56 loc) · 3.03 KB
/
TestECCMultiplier.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var ECCMultiplier = artifacts.require("ECCMultiplier");
var BigNumber = require('bignumber.js');
contract('ECCMultiplier', function(accounts) {
let contractInstance;
it("Organizer should be able to register eligible voters", function() {
return ECCMultiplier.deployed().then(function(instance) {
contractInstance = instance;
return contractInstance.multiply('0x30f3b9cabd330033659940195aeb4729c397d9fcf8676ca0b45fc9d6644b604a',['0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798','0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8',1]);
}).then(function(member) {
console.log(new BigNumber(member[0]).toString(16));
console.log(new BigNumber(member[1]).toString(16));
console.log(new BigNumber(member[2]).toString(16));
});
});
/*
it("Organizer should be able to remove eligible voters", function() {
return Election.deployed().then(function(instance) {
electionContractInstance.addEligibleVoter(accounts[1]);
return electionContractInstance.eligibleVoters.call(accounts[1]);
}).then(function(member) {
assert.equal(member[0], true, "Second account should be registered already");
electionContractInstance.removeEligibleVoter(accounts[1]);
return electionContractInstance.eligibleVoters.call(accounts[1]);
}).then(function(member) {
assert.equal(member[0], false, "Second account should have been removed!")
});
});
it("Voters should be able to vote", function() {
return Election.deployed().then(function(instance) {
electionContractInstance.addEligibleVoter(accounts[0]);
electionContractInstance.Vote(1,1,"80084422859880547211683076133703299733277748156566366325829078699459944778998",12);
return electionContractInstance.votes.call(1);
}).then(function(member) {
assert.equal(member.toNumber(), 1, "Vote has been cast");
});
});
it("Votesuccess event should be emitted", function() {
return Election.deployed().then(function(instance) {
electionContractInstance.addEligibleVoter(accounts[0]);
return electionContractInstance.Vote(1,1,"80084422859880547211683076133703299733277748156566366325829078699459944778998",12);
}).then(function(member) {
assert.equal(member.logs[1].args.voter,accounts[0], 'The event is emitted');
});
});
it("Voters should be only able to cast a valid vote", function() {
return Election.deployed().then(function(instance) {
electionContractInstance.addEligibleVoter(accounts[0]);
return electionContractInstance.Vote(1);
}).then(() => {
assert.ok(false, "It didn't fail");
}, () => {
assert.ok(true, "Passed");
});
});
*/
});