tests/testthat/test-eq_mp.R

context("eq_mp()")


test_that("eq_mp() properly deals with spaces", {
  expect_equal(eq_mp("y = x"), mp("y - x"))
  expect_equal(eq_mp("y   =x"), mp("y - x"))
})


test_that("eq_mp() works with = or ==", {
  expect_equal(eq_mp("y = x"), eq_mp("y == x"))
})


test_that("eq_mp() is properly vectorized", {
  expect_equal(
    eq_mp(c("y = x", "x^2 + y^2 = 1")), 
    mp(c("y - x", "x^2 + y^2 - 1"))
  )
})

Try the mpoly package in your browser

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

mpoly documentation built on March 26, 2020, 7:33 p.m.