diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-09 21:18:43 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-09 21:18:43 +0200 |
commit | ee7f75d94f2a70d61a71eca9416d51a3268859d7 (patch) | |
tree | e6273417231ae83178cf8d5050d02bc59ff195d9 /testsuite/factor.tests | |
parent | 87ae0fe095686b169ab1aeeb25c8ac3f5be30feb (diff) | |
download | busybox-w32-ee7f75d94f2a70d61a71eca9416d51a3268859d7.tar.gz busybox-w32-ee7f75d94f2a70d61a71eca9416d51a3268859d7.tar.bz2 busybox-w32-ee7f75d94f2a70d61a71eca9416d51a3268859d7.zip |
factor: new applet
thus far only able to factor up to ULLONG_MAX
function old new delta
factor_main - 378 +378
packed_usage 31427 31502 +75
applet_names 2590 2597 +7
applet_main 1500 1504 +4
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 3/0 up/down: 464/0) Total: 464 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite/factor.tests')
-rwxr-xr-x | testsuite/factor.tests | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/factor.tests b/testsuite/factor.tests new file mode 100755 index 000000000..2cf4a54ce --- /dev/null +++ b/testsuite/factor.tests | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Copyright 2017 by Denys Vlasenko <vda.linux@googlemail.com> | ||
4 | # Licensed under GPLv2, see file LICENSE in this source tree. | ||
5 | |||
6 | . ./testing.sh | ||
7 | |||
8 | # testing "test name" "command" "expected result" "file input" "stdin" | ||
9 | # file input will be file called "input" | ||
10 | # test can create a file "actual" instead of writing to stdout | ||
11 | |||
12 | testing "factor ' 0'" \ | ||
13 | "factor ' 0'" \ | ||
14 | "0:\n" \ | ||
15 | "" "" | ||
16 | testing "factor +1" \ | ||
17 | "factor +1" \ | ||
18 | "1:\n" \ | ||
19 | "" "" | ||
20 | testing "factor ' +2'" \ | ||
21 | "factor ' +2'" \ | ||
22 | "2: 2\n" \ | ||
23 | "" "" | ||
24 | |||
25 | testing "factor 1024" \ | ||
26 | "factor 1024" \ | ||
27 | "1024: 2 2 2 2 2 2 2 2 2 2\n" \ | ||
28 | "" "" | ||
29 | |||
30 | testing "factor 2^61-1" \ | ||
31 | "factor 2305843009213693951" \ | ||
32 | "2305843009213693951: 2305843009213693951\n" \ | ||
33 | "" "" | ||
34 | testing "factor 2^62-1" \ | ||
35 | "factor 4611686018427387903" \ | ||
36 | "4611686018427387903: 3 715827883 2147483647\n" \ | ||
37 | "" "" | ||
38 | testing "factor 2^64-1" \ | ||
39 | "factor 18446744073709551615" \ | ||
40 | "18446744073709551615: 3 5 17 257 641 65537 6700417\n" \ | ||
41 | "" "" | ||
42 | # This is a 60-bit number (0x888 86ff db34 4692): first few primes multiplied together: | ||
43 | testing "factor \$((2*3*5*7*11*13*17*19*23*29*31*37*41*43*47))" \ | ||
44 | "factor \$((2*3*5*7*11*13*17*19*23*29*31*37*41*43*47))" \ | ||
45 | "614889782588491410: 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47\n" \ | ||
46 | "" "" | ||
47 | |||
48 | exit $FAILCOUNT | ||