-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from yusufidimaina9989/master
Add Modular Exponentiation test
- Loading branch information
Showing
3 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expect, use } from 'chai' | ||
import { Test } from '../src/contracts/library' | ||
import { L } from '../src/contracts/library' | ||
import { getDefaultSigner } from './utils/helper' | ||
import chaiAsPromised from 'chai-as-promised' | ||
use(chaiAsPromised) | ||
|
||
describe('Test SmartContract `Test`', () => { | ||
let instance: Test | ||
let l = new L(2n, 3n) | ||
|
||
before(async () => { | ||
await Test.compile() | ||
instance = new Test(2n, l) | ||
await instance.connect(getDefaultSigner()) | ||
}) | ||
|
||
it('should pass the public method unit test successfully.', async () => { | ||
const deployTx = await instance.deploy(1) | ||
console.log(' Library Test contract deployed: ', deployTx.id) | ||
|
||
const callContract = async () => { | ||
await instance.methods.unlock( | ||
3n | ||
) | ||
expect(callContract()).not.throw | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { expect, use } from 'chai' | ||
import { MethodCallOptions} from 'scrypt-ts' | ||
import { ModExp } from '../src/contracts/modEXP' | ||
import { getDefaultSigner } from './utils/helper' | ||
import chaiAsPromised from 'chai-as-promised' | ||
import { describe } from 'mocha' | ||
|
||
use(chaiAsPromised) | ||
|
||
describe('Test SmartContract `modEXP`', () => { | ||
let instance: ModExp | ||
before(async () => { | ||
await ModExp.compile() | ||
|
||
instance = new ModExp(13n) | ||
await instance.connect(getDefaultSigner()) | ||
}) | ||
|
||
it('should pass the public method unit test successfully.', async () => { | ||
const deployTx = await instance.deploy(1) | ||
console.log('modEXP contract deployed: ', deployTx.id) | ||
|
||
|
||
const callContract = async () => { | ||
await instance.methods.main( | ||
2n,3n,8n | ||
) | ||
expect(callContract()).not.throw | ||
} | ||
|
||
}) | ||
|
||
}) |