1 2## Copyright (C) 2010 - 2019 John Chambers, Dirk Eddelbuettel and Romain Francois 3## 4## This file is part of Rcpp. 5## 6## Rcpp is free software: you can redistribute it and/or modify it 7## under the terms of the GNU General Public License as published by 8## the Free Software Foundation, either version 2 of the License, or 9## (at your option) any later version. 10## 11## Rcpp is distributed in the hope that it will be useful, but 12## WITHOUT ANY WARRANTY; without even the implied warranty of 13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14## GNU General Public License for more details. 15## 16## You should have received a copy of the GNU General Public License 17## along with Rcpp. If not, see <http://www.gnu.org/licenses/>. 18 19if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.") 20 21Rcpp::sourceCpp("cpp/modref.cpp") 22 23# test.modRef <- function() { 24ww <- new(ModRefWorld) 25wg <- ModRefWorld$new() 26 27expect_equal(ww$greet(), wg$greet()) 28wgg <- wg$greet() 29 30ww$set("Other") 31 32## test independence of ww, wg 33expect_equal(ww$greet(), "Other") 34expect_equal(wg$greet(), wgg) 35 36ModRefWorld$methods(twice = function() paste(greet(), greet())) 37 38expect_equal(ww$twice(), paste(ww$greet(), ww$greet())) 39