-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b84984
commit f9fb3bf
Showing
3 changed files
with
58 additions
and
3 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
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,55 @@ | ||
import gleam/queue | ||
import lenient_parse/internal/build | ||
import startest/expect | ||
|
||
pub fn build_float_value_whole_number_test() { | ||
let a = queue.from_list([1]) | ||
let b = queue.from_list([]) | ||
|
||
build.float_value( | ||
is_positive: True, | ||
whole_digits: a, | ||
fractional_digits: b, | ||
scale_factor: 0, | ||
) | ||
|> expect.to_equal(1.0) | ||
} | ||
|
||
pub fn build_float_value_whole_number_with_zero_fraction_test() { | ||
let a = queue.from_list([1]) | ||
let b = queue.from_list([0]) | ||
|
||
build.float_value( | ||
is_positive: True, | ||
whole_digits: a, | ||
fractional_digits: b, | ||
scale_factor: 0, | ||
) | ||
|> expect.to_equal(1.0) | ||
} | ||
|
||
pub fn build_float_value_fractional_only_test() { | ||
let a = queue.from_list([]) | ||
let b = queue.from_list([1]) | ||
|
||
build.float_value( | ||
is_positive: True, | ||
whole_digits: a, | ||
fractional_digits: b, | ||
scale_factor: 0, | ||
) | ||
|> expect.to_equal(0.1) | ||
} | ||
|
||
pub fn build_float_value_zero_whole_with_fraction_test() { | ||
let a = queue.from_list([0]) | ||
let b = queue.from_list([1]) | ||
|
||
build.float_value( | ||
is_positive: True, | ||
whole_digits: a, | ||
fractional_digits: b, | ||
scale_factor: 0, | ||
) | ||
|> expect.to_equal(0.1) | ||
} |