[Rcpp-commits] r3254 - in pkg/int64: . R inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 1 13:46:47 CET 2011


Author: romain
Date: 2011-11-01 13:46:46 +0100 (Tue, 01 Nov 2011)
New Revision: 3254

Modified:
   pkg/int64/ChangeLog
   pkg/int64/R/int64.R
   pkg/int64/inst/unitTests/runit.int64.R
Log:
unit tests for unique

Modified: pkg/int64/ChangeLog
===================================================================
--- pkg/int64/ChangeLog	2011-11-01 12:39:22 UTC (rev 3253)
+++ pkg/int64/ChangeLog	2011-11-01 12:46:46 UTC (rev 3254)
@@ -3,5 +3,7 @@
     * R/int64.R: implementation of unique for int64 and uint64
     
     * man/unique-methods.Rd: documentation of the above
+    
+    * inst/unitTests/runit.int64.R: unit tests for unique
 
 

Modified: pkg/int64/R/int64.R
===================================================================
--- pkg/int64/R/int64.R	2011-11-01 12:39:22 UTC (rev 3253)
+++ pkg/int64/R/int64.R	2011-11-01 12:46:46 UTC (rev 3254)
@@ -189,11 +189,12 @@
     .Call( int64_limits, type )
 }
 
-._unique_int64 <- function(x, incomparables = FALSE, ...){
-    new( "int64", data = unique( x at .Data, incomparables, ... ) )  
-}
 setGeneric( "unique" )
-setMethod( "unique", "int64", ._unique_int64 )
-setMethod( "unique", "uint64", ._unique_int64 )
+setMethod( "unique", "int64", function(x, incomparables = FALSE, ...){
+    new( "int64", .Data = unique( x at .Data, incomparables, ... ) )  
+} )
+setMethod( "unique", "uint64", function(x, incomparables = FALSE, ...){
+    new( "uint64", .Data = unique( x at .Data, incomparables, ... ) )  
+} )
 
 

Modified: pkg/int64/inst/unitTests/runit.int64.R
===================================================================
--- pkg/int64/inst/unitTests/runit.int64.R	2011-11-01 12:39:22 UTC (rev 3253)
+++ pkg/int64/inst/unitTests/runit.int64.R	2011-11-01 12:46:46 UTC (rev 3254)
@@ -65,3 +65,13 @@
 
 }
 
+
+test.unique.int64 <- function(){
+    x <- as.int64( c(1:5, 1L, 3L) )
+    checkEquals( unique(x), as.int64(1:5) )
+    
+    x <- as.uint64( c(1:5, 1L, 3L) )
+    checkEquals( unique(x), as.uint64(1:5) )
+    
+}
+



More information about the Rcpp-commits mailing list