We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9cfcd46 commit 4530c1eCopy full SHA for 4530c1e
t/05-categorize-to-intervals.rakutest
@@ -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
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