Skip to content

Commit 4530c1e

Browse files
committed
test:First version of categorization tests.
1 parent 9cfcd46 commit 4530c1e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
use Test;
3+
use ML::SparseMatrixRecommender;
4+
use ML::SparseMatrixRecommender::Utilities;
5+
6+
my @values = 3.2, 1.5, 7.8, 4.1, 9.9, 2.3, 6.5, 0.8, 5.5, 8.7;
7+
8+
## 1
9+
ok ML::SparseMatrixRecommender::Utilities::categorize-to-intervals(@values), 'ok call';
10+
11+
## 2
12+
is-deeply
13+
ML::SparseMatrixRecommender::Utilities::categorize-to-intervals(@values),
14+
[2, 0, 6, 3, 8, 1, 5, 0, 4, 7],
15+
'expected result, no breaks, no interval names';
16+
17+
## 3
18+
is-deeply
19+
ML::SparseMatrixRecommender::Utilities::categorize-to-intervals(@values, breaks => [0, 3, 6, 10]),
20+
[1, 0, 2, 1, 2, 0, 2, 0, 1, 2],
21+
'expected result, with breaks, no interval names';
22+
23+
## 4
24+
is
25+
ML::SparseMatrixRecommender::Utilities::categorize-to-intervals(@values, :interval-names).all ~~ Str:D,
26+
True,
27+
'expected result, no breaks, with interval names';
28+
29+
done-testing;

0 commit comments

Comments
 (0)