tests/testthat/test_aaf.R

test_that("Test suite aaf.R",{  # tests of division
    small <- 1e-4
    tiny <- 1e-10
    signature(Inf,0)
    checker1 <- function(A){
        if(Mod(A)>small){
            expect_true(Mod(A/A-1) < tiny)
            expect_true(Mod(A^2/A-A)  < tiny)
        }
    }
    
    checker2 <- function(A,B){
        if(Mod(B)>small){
            expect_true( Mod((A/B)*B-A) < tiny)
            expect_true( Mod((A*B)/B-A) < tiny)
            expect_true( Mod(((A*B)/B)/A-1) < tiny)
        }
    }
    
    for(n in 1:9){
        A <- rcliff(d=5)
        B <- rcliff(d=5)
        checker1(A)
        checker2(A,B)
    }

    # Some spot checks:
    expect_error(1/(1+e(1:6)))

})

Try the clifford package in your browser

Any scripts or data that you put into this service are public.

clifford documentation built on Aug. 14, 2022, 1:05 a.m.