Skip to content

Commit 16403c8

Browse files
committed
test:Commented out use lib; complex numbers tests.
1 parent ffcf0c7 commit 16403c8

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

t/01-distance-functions.rakutest

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6.d;
22
use Test;
33

4-
use lib <. lib>;
4+
# use lib <. lib>;
55

66
use Math::DistanceFunctions::Native;
77

@@ -11,17 +11,20 @@ plan *;
1111
is cosine-distance([1,1,0], [0,1,2]), 1 - 1 / sqrt(10), 'Cosine distance over arrays';
1212

1313
## 2
14-
is euclidean-distance([1,1,0], [0,1,2]), sqrt(5), 'Euclidean distance over arrays';
14+
is squared-euclidean-distance([1,1,0], [0,1,2]), 5, 'Squared Euclidean distance over arrays';
1515

1616
## 3
17-
dies-ok { euclidean-distance([1,1,0,2], [0,1,2]) }, 'Euclidean distance over non-same length arrays';
17+
is euclidean-distance([1,1,0], [0,1,2]), sqrt(5), 'Euclidean distance over arrays';
1818

1919
## 4
20+
dies-ok { euclidean-distance([1,1,0,2], [0,1,2]) }, 'Euclidean distance over non-same length arrays';
21+
22+
## 5
2023
# This does not work because of the idiotic Raku ideas about Seq and slurpy arguments.
2124
#is norm([1,2,3] Z- [2,4,6], p => 1), 6, '1-Norm over array';
2225
is norm(([1,2,3] Z- [2,4,6]).Array, p => "1"), 6, '1-Norm over array';
2326

24-
## 5
27+
## 6
2528
is norm(v => ([1,2,3] Z- [2,4,6]).Array, p => 'max'), 3, 'Max-norm over array';
2629

2730
done-testing;

t/02-edit-distance.rakutest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6.d;
22
use Test;
33

4-
use lib <. lib>;
4+
# use lib <. lib>;
55

66
use Math::DistanceFunctions::Native;
77

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use v6.d;
2+
use Test;
3+
4+
# use lib <. lib>;
5+
6+
use Math::DistanceFunctions::Native;
7+
8+
plan *;
9+
10+
## 1
11+
is squared-euclidean-distance([1+1i,1+1i,0], [0+1i,1,2+1i]), 7, 'Squared Euclidean distance over arrays';
12+
13+
## 2
14+
dies-ok { squared-euclidean-distance([1+1i,1+1i,0+1i,2+1i], [0+1i,1+1i,2+1i]) }, 'Squared Euclidean distance over non-same length arrays';
15+
16+
## 3
17+
is euclidean-distance([1+1i,1+1i,0], [0+1i,1,2+1i]), sqrt(7), 'Euclidean distance over arrays';
18+
19+
## 4
20+
is cosine-distance([1+1i,1+1i,0], [0+1i,1,2+1i]) - (1 - 1/sqrt(7)) ≤ 1e-10, True, 'Cosine distance over arrays';
21+
22+
done-testing;

0 commit comments

Comments
 (0)