Changeset: 24e0056303d6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=24e0056303d6
Removed Files:
        clients/R/db.tests/monetdb.test.R
        clients/R/db.tests/monetframe.test.R
        clients/R/db.tests/sqlsurvey.test.R
Branch: Oct2014
Log Message:

R Connector: cleanup old test cases


Unterschiede (278 Zeilen):

diff --git a/clients/R/db.tests/monetdb.test.R 
b/clients/R/db.tests/monetdb.test.R
deleted file mode 100644
--- a/clients/R/db.tests/monetdb.test.R
+++ /dev/null
@@ -1,134 +0,0 @@
-options(monetdb.debug.query=T)
-options(monetdb.insert.splitsize=10)
-
-library(MonetDB.R)
-
-drv <- dbDriver("MonetDB")
-stopifnot(identical(dbGetInfo(drv)$name,"MonetDBDriver"))
-
-con <- dbConnect(drv, "monetdbrtest")
-stopifnot(identical(class(con)[[1]],"MonetDBConnection"))
-# overwrite variable to force destructor
-con <- dbConnect(drv, "monetdbrtest")
-con <- dbConnect(drv, "monetdbrtest")
-gc()
-
-# basic MAPI/SQL test
-stopifnot(identical(dbGetQuery(con,"SELECT 'DPFKG!'")[[1]],"DPFKG!"))
-
-# remove test table
-if (dbExistsTable(con,"monetdbtest")) dbRemoveTable(con,"monetdbtest")
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),FALSE))
-
-
-# test raw handling
-dbSendUpdate(con,"CREATE TABLE monetdbtest (a varchar(10),b integer,c blob)")
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),TRUE))
-dbSendUpdate(con,"INSERT INTO monetdbtest VALUES ('one',1,'1111')")
-dbSendUpdate(con,"INSERT INTO monetdbtest VALUES ('two',2,'22222222')")
-stopifnot(identical(dbGetQuery(con,"SELECT count(*) FROM monetdbtest")[[1]],2))
-stopifnot(identical(dbReadTable(con,"monetdbtest")[[3]],list(charToRaw("1111"),charToRaw("22222222"))))
-stopifnot(identical(as.character(dbListTables(con)),"monetdbtest"))
-
-dbRemoveTable(con,"monetdbtest")
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),FALSE))
-
-# write test table iris
-data(iris)
-dbWriteTable(con,"monetdbtest",iris)
-
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),TRUE))
-stopifnot(identical(dbExistsTable(con,"monetdbtest2"),FALSE))
-stopifnot("monetdbtest" %in% dbListTables(con))
-
-stopifnot(identical(dbListFields(con,"monetdbtest"),c("sepal_length","sepal_width","petal_length","petal_width","species")))
-# get stuff, first very convenient
-iris2 <- dbReadTable(con,"monetdbtest")
-stopifnot(identical(dim(iris),dim(iris2)))
-
-
-# then manually
-res <- dbSendQuery(con,"SELECT species, sepal_width FROM monetdbtest")
-stopifnot(identical(class(res)[[1]],"MonetDBResult"))
-stopifnot(identical(res@env$success,TRUE))
-
-stopifnot(dbColumnInfo(res)[[1,1]] == "species")
-stopifnot(dbColumnInfo(res)[[2,1]] == "sepal_width")
-
-stopifnot(dbGetInfo(res)$row.count == 150 && res@env$info$rows == 150)
-
-data <- fetch(res,10)
-stopifnot(dim(data)[[1]] == 10)
-stopifnot(dim(data)[[2]] == 2)
-stopifnot(res@env$delivered == 10)
-stopifnot(dbHasCompleted(res) == FALSE)
-
-data2 <- fetch(res,-1)
-stopifnot(dim(data2)[[1]] == 140)
-stopifnot(dbHasCompleted(res) == TRUE)
-
-dbClearResult(res)
-
-# remove table again
-dbRemoveTable(con,"monetdbtest")
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),FALSE))
-
-# test csv import
-file <- tempfile()
-write.table(iris,file,sep=",")
-monetdb.read.csv(con,file,"monetdbtest",150)
-unlink(file)
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),TRUE))
-iris3 <- dbReadTable(con,"monetdbtest")
-stopifnot(identical(dim(iris),dim(iris3)))
-stopifnot(identical(dbListFields(con,"monetdbtest"),c("sepal_length","sepal_width","petal_length","petal_width","species")))
-dbRemoveTable(con,"monetdbtest")
-stopifnot(identical(dbExistsTable(con,"monetdbtest"),FALSE))
-# test dbWriteTable
-conn <- con
-tname <- "mtcars"
-
-tsize <- function(conn,tname) 
-       as.integer(dbGetQuery(conn,paste0("SELECT COUNT(*) FROM ",tname))[[1]])
-
-# clean up
-if (dbExistsTable(conn,tname))
-       dbRemoveTable(conn,tname)
-
-# table does not exist, append=F, overwrite=F, this should work
-dbWriteTable(conn,tname,mtcars,append=F,overwrite=F)
-stopifnot(dbExistsTable(conn,tname))
-stopifnot(identical(nrow(mtcars),tsize(conn,tname)))
-
-# these should throw errors
-errorThrown <- F
-tryCatch(dbWriteTable(conn,tname,mtcars,append=F,overwrite=F),error=function(e){errorThrown
 <<- T})
-stopifnot(errorThrown)
-
-errorThrown <- F
-tryCatch(dbWriteTable(conn,tname,mtcars,overwrite=T,append=T),error=function(e){errorThrown
 <<- T})
-stopifnot(errorThrown)
-
-# this should be fine
-dbWriteTable(conn,tname,mtcars,append=F,overwrite=T)
-stopifnot(dbExistsTable(conn,tname))
-stopifnot(identical(nrow(mtcars),tsize(conn,tname)))
-
-# append to existing table
-dbWriteTable(conn,tname,mtcars,append=T,overwrite=F)
-stopifnot(identical(as.integer(2*nrow(mtcars)),tsize(conn,tname)))
-dbRemoveTable(conn,tname)
-
-dbRemoveTable(conn,tname)
-dbWriteTable(conn,tname,mtcars,append=F,overwrite=F,insert=T)
-dbRemoveTable(conn,tname)
-
-#thrice to catch null pointer errors
-stopifnot(identical(dbDisconnect(con),TRUE))
-stopifnot(identical(dbDisconnect(con),TRUE))
-stopifnot(identical(dbDisconnect(con),TRUE))
-
-#test merovingian control code
-stopifnot("monetdbrtest" %in% monetdbd.liststatus("monetdb")$dbname)
-
-print("SUCCESS")
diff --git a/clients/R/db.tests/monetframe.test.R 
b/clients/R/db.tests/monetframe.test.R
deleted file mode 100644
--- a/clients/R/db.tests/monetframe.test.R
+++ /dev/null
@@ -1,76 +0,0 @@
-library(monet.frame)
-options(monetdb.debug.query=T)
-
-con <- dbConnect(dbDriver("MonetDB"), 
"monetdb://localhost:50000/monetdbrtest", "monetdb", "monetdb",timeout=100)
-
-table <- "monetframetest"
-
-
-fcmp <- function(f1,f2,epsilon) {
-       abs(f1-f2) < epsilon
-}
-
-# basic MAPI/SQL test
-stopifnot(identical(dbGetQuery(con,"SELECT 'DPFKG!'")[[1]],"DPFKG!"))
-
-if (!dbExistsTable(con,table)) {
-       data(iris)
-       dbWriteTable(con,table,iris, overwrite=TRUE)
-}
-stopifnot(identical(dbExistsTable(con,table),TRUE))
-
-# aight
-frame <- monet.frame(con,table)
-stopifnot(identical(class(frame)[[1]],"monet.frame"))
-
-# we should get the very same from monet.frame and dbReadTable
-plaindata <- dbReadTable(con,table)
-stopifnot(identical(as.data.frame(frame),plaindata))
-
-# do as.vector / $ work?
-stopifnot(identical(as.vector(frame$sepal_width),plaindata$sepal_width))
-
-# does [] work?
-stopifnot(identical(as.data.frame(frame[1:10,c("sepal_length","species")]),plaindata[1:10,c("sepal_length","species")]))
-
-# names(), dim()
-stopifnot(identical(names(frame),c("sepal_length","sepal_width","petal_length","petal_width","species")))
-stopifnot(dim(frame)[[1]] == 150)
-stopifnot(dim(frame)[[2]] == 5)
-
-# Ops
-stopifnot(identical(plaindata$sepal_width*plaindata$sepal_length,as.vector(frame$sepal_width*frame$sepal_length)))
-stopifnot(identical(plaindata$sepal_width*42,as.vector(frame$sepal_width*42)))
-stopifnot(identical(42*plaindata$sepal_length,as.vector(42*frame$sepal_length)))
-stopifnot(identical(plaindata$sepal_length > 1.4,as.vector(frame$sepal_length 
> 1.4)))
-
-# Summary
-stopifnot(identical(min(plaindata$sepal_length),min(frame$sepal_length)))
-stopifnot(identical(max(plaindata$sepal_length),max(frame$sepal_length)))
-stopifnot(identical(round(mean(plaindata$sepal_length),2),round(mean(frame$sepal_length),2)[[1]]))
-
-# Math
-stopifnot(identical(signif(plaindata$sepal_length*1000,2),as.vector(signif(frame$sepal_length
 * 1000,2))))
-
-
-# subset
-# have to realign row numbers for compat.
-sdf <- subset(plaindata,sepal_width > 3 & species == "setosa")
-rownames(sdf) <- 1:nrow(sdf)
-smf <- as.data.frame(subset(frame,sepal_width > 3 & species == "setosa"))
-stopifnot(identical(sdf,smf))
-
-# moar ops
-stopifnot(fcmp(
-       sd(plaindata$sepal_width),
-       sd(frame$sepal_width)
-,0.1))
-
-stopifnot(fcmp(
-       var(plaindata$sepal_width),
-       var(frame$sepal_width)
-,0.1))
-
-dbRemoveTable(con,table)
-dbDisconnect(con)
-print("SUCCESS")
diff --git a/clients/R/db.tests/sqlsurvey.test.R 
b/clients/R/db.tests/sqlsurvey.test.R
deleted file mode 100644
--- a/clients/R/db.tests/sqlsurvey.test.R
+++ /dev/null
@@ -1,53 +0,0 @@
-library(MonetDB.R)
-library(sqlsurvey)
-
-options(monetdb.debug.query=T)
-
-# install.packages("sqlsurvey", 
repos=c("http://cran.r-project.org","http://R-Forge.R-project.org";), dep=TRUE)
-
-db <- dbConnect( MonetDB.R() , "monetdb://localhost/monetdbrtest")
-
-data( api )
-
-x <- apiclus1
-x$idkey <- 1:nrow( x )
-
-# monetdb doesn't like the column name `full`
-x$full <- NULL
-
-# load the apiclus1 data set into the monetdb
-dbWriteTable( db , 'apiclus1' , x , overwrite = TRUE )
-
-dclus1 <-
-               sqlsurvey(
-                               weight = 'pw' ,
-                               id = 'dnum' ,
-                               # fpc = 'fpc' ,
-                               table.name = 'apiclus1' ,
-                               key = "idkey" ,
-                               database = "monetdb://localhost/monetdbrtest" ,
-                               driver = MonetDB.R() ,
-                               user = "monetdb" ,
-                               password = "monetdb" 
-               )
-
-# only a problem for factor variables..
-
-# these all work
-svymean( ~dname , dclus1 )
-svymean( ~dname , dclus1 , se = TRUE )
-svymean( ~dname , dclus1 , byvar = ~comp_imp )
-# then this breaks!
-svymean( ~dname , dclus1 , byvar = ~comp_imp , se = TRUE )
-
-# ..and now these same three commands no longer work!
-svymean( ~dname , dclus1 )
-svymean( ~dname , dclus1 , se = TRUE )
-svymean( ~dname , dclus1 , byvar = ~comp_imp )
-
-# but then actual queries do work
-dbGetQuery( db , 'select * from apiclus1 limit 2' )
-dbRemoveTable(db,"apiclus1")
-
-
-print("SUCCESS")
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to