tests/testthat/test-codegen.R

context("codegen")

test_that("ccode", {
    x <- S("x^y")
    expect_identical(codegen(x, "ccode"), "pow(x, y)")
})

test_that("mathml", {
    x <- S("x^y")
    expect_identical(codegen(x, "mathml"), "<apply><power/><ci>x</ci><ci>y</ci></apply>")
})

test_that("latex", {
    x <- S("x^y")
    expect_identical(codegen(x, "latex"), "x^y")
})

test_that("jscode", {
    x <- S("x^y")
    expect_identical(codegen(x, "jscode"), "Math.pow(x, y)")
})

Try the symengine package in your browser

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

symengine documentation built on Oct. 23, 2022, 5:06 p.m.