[Rcpp-commits] r4241 - in pkg/Rcpp/inst/unitTests: . cpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 4 17:56:19 CET 2013


Author: romain
Date: 2013-02-04 17:56:19 +0100 (Mon, 04 Feb 2013)
New Revision: 4241

Modified:
   pkg/Rcpp/inst/unitTests/cpp/wstring.cpp
   pkg/Rcpp/inst/unitTests/runit.wstring.R
Log:
more unit tests

Modified: pkg/Rcpp/inst/unitTests/cpp/wstring.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/cpp/wstring.cpp	2013-02-04 16:47:39 UTC (rev 4240)
+++ pkg/Rcpp/inst/unitTests/cpp/wstring.cpp	2013-02-04 16:56:19 UTC (rev 4241)
@@ -25,3 +25,19 @@
     return s ;
 }
 
+// [[Rcpp::export]]
+std::vector<std::wstring> wrap_vector_wstring(){
+    std::vector<std::wstring> res(2 ); 
+    res[0] = L"foo" ;
+    res[1] = L"bar" ;
+    return res;
+}
+
+// [[Rcpp::export]]
+std::vector<std::wstring> as_vector_wstring( std::vector<std::wstring> x){
+    for( size_t i=0; i<x.size(); i++){
+        x[i] += L"€" ;    
+    }
+    return x ;        
+}
+

Modified: pkg/Rcpp/inst/unitTests/runit.wstring.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.wstring.R	2013-02-04 16:47:39 UTC (rev 4240)
+++ pkg/Rcpp/inst/unitTests/runit.wstring.R	2013-02-04 16:56:19 UTC (rev 4241)
@@ -40,4 +40,12 @@
     checkEquals( wstring_param( "foo", "bar" ), "foobar" )    
 }
 
+test.wrap_vector_wstring <- function(){
+    checkEquals( wrap_vector_wstring( ), c("foo", "bar" ) )    
 }
+
+test.as_vector_wstring <- function(){
+    checkEquals( as_vector_wstring(letters), paste( letters, "€", sep = "" ) )
+}
+
+}



More information about the Rcpp-commits mailing list