v / vlib / math / log_test.v
22 lines · 17 sloc · 351 bytes · d95dac4a0189a21c4e111a9ae89e344828ee1623
Raw
1import math
2
3fn test_log_base() {
4 assert math.log(math.e) == 1.0
5}
6
7fn test_log2_base() {
8 assert math.log2(2.0) == 1.0
9}
10
11fn test_log10_base() {
12 assert math.log10(10.0) == 1.0
13 assert math.log10(0.00000000000000001) == -17.0
14}
15
16fn test_log1p_base() {
17 assert math.log1p(math.e - 1) == 1.0
18}
19
20fn test_log_b_base() {
21 assert math.log_b(2.0) == 1.0
22}
23