-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Math.bigint in SC * Math.bigint always return an integer or raise --------- Co-authored-by: bchamagne <[email protected]>
- Loading branch information
1 parent
a53a328
commit f7ebcd2
Showing
2 changed files
with
61 additions
and
0 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
11 changes: 11 additions & 0 deletions
11
test/archethic/contracts/interpreter/library/common/math_test.exs
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 |
---|---|---|
@@ -1,7 +1,18 @@ | ||
defmodule Archethic.Contracts.Interpreter.Library.Common.MathTest do | ||
use ArchethicCase | ||
|
||
alias Archethic.Contracts.Interpreter.Library | ||
alias Archethic.Contracts.Interpreter.Library.Common.Math | ||
|
||
doctest Math | ||
|
||
test "exceed decimals raise" do | ||
assert_raise Library.Error, "Number exceeds decimals", fn -> | ||
Math.bigint(0.1234, 2) | ||
end | ||
|
||
assert_raise Library.Error, "Number exceeds decimals", fn -> | ||
Math.bigint(0.12345874564, 8) | ||
end | ||
end | ||
end |