From ac1b0efe643695480beb505fb10d25689c4be5ef Mon Sep 17 00:00:00 2001 From: "Roger D. Peng [audrey]" <rpeng@jhsph.edu> Date: Tue, 26 Aug 2008 08:44:25 -0400 Subject: [PATCH] Add some test databases for each version Create a test database with each version so that we can test for back compatibility in the future. --- tests/SHA1SUM | 2 + tests/misc/create-testdb.R | 14 +++++ tests/testdb-v1.1 | Bin 0 -> 726 bytes tests/testdb-v2.0 | Bin 0 -> 726 bytes tests/versions.R | 22 +++++++ tests/versions.Rout.save | 115 +++++++++++++++++++++++++++++++++++++ 6 files changed, 153 insertions(+) create mode 100644 tests/SHA1SUM create mode 100644 tests/misc/create-testdb.R create mode 100644 tests/testdb-v1.1 create mode 100644 tests/testdb-v2.0 create mode 100644 tests/versions.R create mode 100644 tests/versions.Rout.save diff --git a/tests/SHA1SUM b/tests/SHA1SUM new file mode 100644 index 0000000..89b6e02 --- /dev/null +++ b/tests/SHA1SUM @@ -0,0 +1,2 @@ +6b1babdfa60a17a2e79cd9187ea06b3df3c46624 testdb-v1.1 +6b1babdfa60a17a2e79cd9187ea06b3df3c46624 testdb-v2.0 diff --git a/tests/misc/create-testdb.R b/tests/misc/create-testdb.R new file mode 100644 index 0000000..f0687f2 --- /dev/null +++ b/tests/misc/create-testdb.R @@ -0,0 +1,14 @@ +library(filehash) + +name <- sprintf("testdb-v%s", packageDescription("filehash", fields = "Version")) +dbCreate(name, "DB1") +db <- dbInit(name, "DB1") + +set.seed(1) +dbInsert(db, "a", rnorm(10)) +dbInsert(db, "b", runif(7)) +dbInsert(db, "list", list(1, 2, 3, 4, 5, 6, "a")) +dbInsert(db, "c", 1L) +dbInsert(db, "entry", "string") +dbDelete(db, "b") + diff --git a/tests/testdb-v1.1 b/tests/testdb-v1.1 new file mode 100644 index 0000000000000000000000000000000000000000..ebeaf0d84bedb5d964f7935702c99d7586abac82 GIT binary patch literal 726 zcma#xVqjokVqjutWME<jG8qJbm=Q>Eg6PBubZK6QG(#GO3?ER2YyT7O7k4)O_-=o^ zasKTq=h^nZ+FN06^R&wTXPc|$#HSYaSH+eeewS>p|COWL%Vk`D?e80L&cAHyX#adc zwBqUNUi(KmXPM(aOYXniUA_BOH#>$cD9%g5kcK(W4?_mzJa+rHFQq;{U|_I6tzJ{y z0HmMXYWk=Eqz?!gRD<{zrBrq}0O=ds#2+yL>F%5q2_TJO8nQE3ax#lcFjT-?(vBe` z3^b4(h(Ru5wEqAkApp#GfbpR64jga+h&;$<2!QZKU|fiK4j|`30J0mg#3YJzGKMQ* y?w7(T!-ydRHIf08c34yMN{T8ml)#Kt!H_}L%vM}dl$n=~OARD(;)wnKKmY*SnOU;{ literal 0 HcmV?d00001 diff --git a/tests/testdb-v2.0 b/tests/testdb-v2.0 new file mode 100644 index 0000000000000000000000000000000000000000..ebeaf0d84bedb5d964f7935702c99d7586abac82 GIT binary patch literal 726 zcma#xVqjokVqjutWME<jG8qJbm=Q>Eg6PBubZK6QG(#GO3?ER2YyT7O7k4)O_-=o^ zasKTq=h^nZ+FN06^R&wTXPc|$#HSYaSH+eeewS>p|COWL%Vk`D?e80L&cAHyX#adc zwBqUNUi(KmXPM(aOYXniUA_BOH#>$cD9%g5kcK(W4?_mzJa+rHFQq;{U|_I6tzJ{y z0HmMXYWk=Eqz?!gRD<{zrBrq}0O=ds#2+yL>F%5q2_TJO8nQE3ax#lcFjT-?(vBe` z3^b4(h(Ru5wEqAkApp#GfbpR64jga+h&;$<2!QZKU|fiK4j|`30J0mg#3YJzGKMQ* y?w7(T!-ydRHIf08c34yMN{T8ml)#Kt!H_}L%vM}dl$n=~OARD(;)wnKKmY*SnOU;{ literal 0 HcmV?d00001 diff --git a/tests/versions.R b/tests/versions.R new file mode 100644 index 0000000..8914862 --- /dev/null +++ b/tests/versions.R @@ -0,0 +1,22 @@ +## Test databases + +library(filehash) + +testdblist <- dir(pattern = glob2rx("testdb-v*")) + +for(testname in testdblist) { + msg <- sprintf("DATABASE: %s\n", testname) + cat(paste(rep("=", nchar(msg)), collapse = ""), "\n") + cat(msg) + cat(paste(rep("=", nchar(msg)), collapse = ""), "\n") + db <- dbInit(testname, "DB1") + keys <- dbList(db) + print(keys) + + for(k in keys) { + cat("key:", k, "\n") + val <- dbFetch(db, k) + print(val) + cat("\n") + } +} diff --git a/tests/versions.Rout.save b/tests/versions.Rout.save new file mode 100644 index 0000000..57a85cb --- /dev/null +++ b/tests/versions.Rout.save @@ -0,0 +1,115 @@ + +R version 2.7.1 (2008-06-23) +Copyright (C) 2008 The R Foundation for Statistical Computing +ISBN 3-900051-07-0 + +R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. + +R is a collaborative project with many contributors. +Type 'contributors()' for more information and +'citation()' on how to cite R or R packages in publications. + +Type 'demo()' for some demos, 'help()' for on-line help, or +'help.start()' for an HTML browser interface to help. +Type 'q()' to quit R. + +> ## Test databases +> +> library(filehash) +filehash: Simple key-value database (2.0 2008-08-03) +> +> testdblist <- dir(pattern = glob2rx("testdb-v*")) +> +> for(testname in testdblist) { ++ msg <- sprintf("DATABASE: %s\n", testname) ++ cat(paste(rep("=", nchar(msg)), collapse = ""), "\n") ++ cat(msg) ++ cat(paste(rep("=", nchar(msg)), collapse = ""), "\n") ++ db <- dbInit(testname, "DB1") ++ keys <- dbList(db) ++ print(keys) ++ ++ for(k in keys) { ++ cat("key:", k, "\n") ++ val <- dbFetch(db, k) ++ print(val) ++ cat("\n") ++ } ++ } +====================== +DATABASE: testdb-v1.1 +====================== +[1] "a" "c" "list" "entry" +key: a + [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 + [7] 0.4874291 0.7383247 0.5757814 -0.3053884 + +key: c +[1] 1 + +key: list +[[1]] +[1] 1 + +[[2]] +[1] 2 + +[[3]] +[1] 3 + +[[4]] +[1] 4 + +[[5]] +[1] 5 + +[[6]] +[1] 6 + +[[7]] +[1] "a" + + +key: entry +[1] "string" + +====================== +DATABASE: testdb-v2.0 +====================== +[1] "a" "c" "list" "entry" +key: a + [1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684 + [7] 0.4874291 0.7383247 0.5757814 -0.3053884 + +key: c +[1] 1 + +key: list +[[1]] +[1] 1 + +[[2]] +[1] 2 + +[[3]] +[1] 3 + +[[4]] +[1] 4 + +[[5]] +[1] 5 + +[[6]] +[1] 6 + +[[7]] +[1] "a" + + +key: entry +[1] "string" + +> -- GitLab