tests/testthat/test-basic.R

test_that("simple expansion", {
  x <- qlone(1)
  y <- qlone(2)
  expect_true((x - y)^2 == x^2 - 2*x*y + y^2)
})

test_that("power", {
  x <- qlone(1)
  y <- qlone(2)
  P <- 2L*x*y - 3L*x - 4L*y 
  expect_true(P^7 == P*P*P*P*P*P*P)
})

test_that("commutativity", {
  x <- qlone(1)
  y <- qlone(2)
  expect_true(x*y == y*x)  
})

test_that("associativity", {
  x <- qlone(1)
  y <- qlone(2)
  z <- qlone(3)
  expect_true(x*(y*z) == (x*y)*z)  
})

test_that("distributivity", {
  x <- qlone(1)
  y <- qlone(2)
  z <- qlone(3)
  expect_true(x*(y+z) == x*y + x*z)
})

Try the qspray package in your browser

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

qspray documentation built on Sept. 11, 2024, 5:33 p.m.