Commit f1ac9e60 authored by Antoine Lucas's avatar Antoine Lucas
Browse files

add tests

parent 1005834d
R Under development (unstable) (2020-06-04 r78645) -- "Unsuffered Consequences"
Copyright (C) 2020 The R Foundation for Statistical Computing
R Under development (unstable) (2022-02-20 r81781) -- "Unsuffered Consequences"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
......@@ -77,11 +77,11 @@ The following objects are masked from 'package:base':
+ "as.bigq",
+ "add.bigq","sub.bigq","div.bigq", "mul.bigq", "pow.bigq",
+ "chooseZ",
+ "max.bigq","max.bigz","min.bigq","min.bigz")
+ "max.bigq","max.bigz","min.bigq","min.bigz","|","&","xor")
> unaryfunctionid <- c("log.bigz","log2.bigz","log10.bigz","c.bigz",
+ "isprime","nextprime", "factorialZ",
+ "sizeinbase","fibnum","fibnum2","lucnum","lucnum2",
+ "factorize","abs")
+ "factorize","abs","!")
> numericFunName <- function(gmpName) {
+ if(gmpName != (r <- sub("[ZQ]$","", gmpName)) &&
+ r!="as" && existsFunction(r)) # e.g. chooseZ
......@@ -110,13 +110,13 @@ The following objects are masked from 'package:base':
"as.bigz" "+" "-" "*" "%/%" "/" "%%" "^" "inv.bigz" "gcd" "gcdex"
lcm.bigz as.bigq add.bigq sub.bigq div.bigq mul.bigq pow.bigq chooseZ max.bigq max.bigz min.bigq
"lcm" "as.bigq" "+" "-" "/" "*" "^" "choose" "max" "max" "min"
min.bigz
"min"
min.bigz | & xor
"min" "|" "&" "xor"
> sapply(unaryfunctionid, numericFunName)
log.bigz log2.bigz log10.bigz c.bigz isprime nextprime factorialZ sizeinbase fibnum
"log" "log2" "log10" "c" "isprime" "nextprime" "factorial" "sizeinbase" "fibnum"
fibnum2 lucnum lucnum2 factorize abs
"fibnum2" "lucnum" "lucnum2" "factorize" "abs"
fibnum2 lucnum lucnum2 factorize abs !
"fibnum2" "lucnum" "lucnum2" "factorize" "abs" "!"
>
>
> ex <- expression(23, "25", 2.3, -4, 4L, 0, as.bigz(34),
......@@ -998,6 +998,57 @@ min.bigz -> num.fn.: min
11 32/7 31 NA <NA> -3
12 -3 -3 -3 <NA> -3
------------------------------------------
|
-> all.equal(target = res, current = F(<numeric x>)):
23. 25 2.3 -4. 4L 0. 34_Z 32/7 (31 %% 45) NULL NA -3L
1 TRUE error TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
2 error error error error error error TRUE TRUE TRUE error error error
3 TRUE error TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
4 TRUE error TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
5 TRUE error TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
6 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
7 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
8 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
9 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
10 <NA> error <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
11 TRUE error TRUE TRUE TRUE <NA> TRUE TRUE TRUE <NA> <NA> TRUE
12 TRUE error TRUE TRUE TRUE TRUE TRUE TRUE TRUE <NA> TRUE TRUE
------------------------------------------
&
-> all.equal(target = res, current = F(<numeric x>)):
23. 25 2.3 -4. 4L 0. 34_Z 32/7 (31 %% 45) NULL NA -3L
1 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
2 error error error error error error TRUE TRUE TRUE error error error
3 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
4 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
5 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
6 FALSE error FALSE FALSE FALSE FALSE FALSE FALSE FALSE <NA> FALSE FALSE
7 TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
8 TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
9 TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
10 <NA> error <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
11 <NA> error <NA> <NA> <NA> FALSE <NA> <NA> <NA> <NA> <NA> <NA>
12 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
------------------------------------------
xor
-> all.equal(target = res, current = F(<numeric x>)):
23. 25 2.3 -4. 4L 0. 34_Z 32/7 (31 %% 45) NULL NA -3L
1 FALSE error FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
2 error error error error error error FALSE FALSE FALSE error error error
3 FALSE error FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
4 FALSE error FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
5 FALSE error FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
6 TRUE error TRUE TRUE TRUE FALSE TRUE TRUE TRUE <NA> <NA> TRUE
7 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
8 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
9 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
10 <NA> error <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
11 <NA> error <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
12 FALSE error FALSE FALSE FALSE TRUE FALSE FALSE FALSE <NA> <NA> FALSE
There were 50 or more warnings (use warnings() to see the first 50)
>
> ##==============================================================================
......@@ -1084,6 +1135,11 @@ abs
23. 25 2.3 -4. 4L 0. 34_Z 32/7 (31 %% 45) NULL NA -3L
1 23 error 2.3 4 4 0 34 32/7 (31 %% 45) error <NA> 3
------------------------------------------
!
23. 25 2.3 -4. 4L 0. 34_Z 32/7 (31 %% 45) NULL NA -3L
1 FALSE error FALSE FALSE FALSE TRUE FALSE FALSE FALSE error <NA> FALSE
>
> ##==============================================================================
>
......@@ -1193,4 +1249,4 @@ Big Integer ('bigz') object of length 2:
>
> proc.time()
user system elapsed
0.380 0.069 0.487
0.470 0.047 0.512
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment