Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JTPetter committed Oct 16, 2024
1 parent 862cb10 commit 072ca77
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 62 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"","�..Month","Size","D","Proportion"
"","Month","Size","D","Proportion"
"1","Sep",150,21,0.14
"2","Oct",153,16,0.105
"3","Nov",170,30,0.176
Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/test-attributesCharts.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ options$total <- "Size"
options$attributesChart <- "defectives"
options$attributesChartDefectivesChartType <- "npChart"
set.seed(1)
results <- runAnalysis("attributesCharts", "SPC_NP.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_NP.csv", options)

test_that("np Chart plot matches", {
plotName <- results[["results"]][["NPchartPlot"]][["data"]]
Expand All @@ -25,7 +25,7 @@ test_that("Test results for np chart table results match", {

# P
options$attributesChartDefectivesChartType <- "pChart"
results <- runAnalysis("attributesCharts", "SPC_P.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_P.csv", options)

test_that("p Chart plot matches", {
plotName <- results[["results"]][["PchartPlot"]][["data"]]
Expand All @@ -35,7 +35,7 @@ test_that("p Chart plot matches", {

# Laney's P
options$attributesChartDefectivesChartType <- "laneyPPrimeChart"
results <- runAnalysis("attributesCharts", "SPC_P.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_P.csv", options)

test_that("Laney p' Chart plot matches", {
plotName <- results[["results"]][["LaneyPPlot"]][["data"]]
Expand All @@ -48,7 +48,7 @@ test_that("Laney p' Chart plot matches", {
options$attributesChartDefectivesChartType <- "npChart"
options$attributesChart <- "defects"
options$attributesChartDefectsChartType <- "cChart"
results <- runAnalysis("attributesCharts", "SPC_NP.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_NP.csv", options)

test_that("c Chart plot matches", {
plotName <- results[["results"]][["CchartPlot"]][["data"]]
Expand All @@ -64,7 +64,7 @@ test_that("Test results for c chart table results match", {

# U
options$attributesChartDefectsChartType <- "uChart"
results <- runAnalysis("attributesCharts", "SPC_P.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_P.csv", options)

test_that("u Chart plot matches", {
plotName <- results[["results"]][["UchartPlot"]][["data"]]
Expand All @@ -74,7 +74,7 @@ test_that("u Chart plot matches", {

# Laneys U
options$attributesChartDefectsChartType <- "laneyUPrimeChart"
results <- runAnalysis("attributesCharts", "SPC_P.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_P.csv", options)

test_that("Laney u' Chart plot matches", {
plotName <- results[["results"]][["LaneyUPlot"]][["data"]]
Expand All @@ -84,7 +84,7 @@ test_that("Laney u' Chart plot matches", {

## I MR
options$attributesChart <- "xmr"
results <- runAnalysis("attributesCharts", "SPC_P.csv", options)
results <- runAnalysis("attributesCharts", "datasets/attributeCharts/SPC_P.csv", options)

test_that("Individuals and Moving Range Chart plot matches", {
plotName <- results[["results"]][["IPlotA"]][["data"]]
Expand Down
51 changes: 17 additions & 34 deletions tests/testthat/test-doeFactorial.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ options$selectedDesign2 <- list(list(levels = "Row 0", name = "data 1", values =
options$selectedRow <- 0 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)


test_that("1.1 Two Factor Two Level Factorial Design table results match", {
Expand Down Expand Up @@ -59,8 +58,7 @@ options$selectedDesign2 <- list(list(levels = c("Row 0", "Row 1", "Row 2"), name
options$selectedRow <- 2 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("2.1 Five Factor Two Level Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -106,8 +104,7 @@ options$selectedDesign2 <- list(list(levels = c("Row 0", "Row 1", "Row 2"), name
options$selectedRow <- 0 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("3.1 Five Factor Two Level Frac. Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -158,8 +155,7 @@ options$selectedDesign2 <- list(list(levels = c("Row 0", "Row 1", "Row 2", "Row
options$selectedRow <- 3 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("4.1 Nine Factor Two Level Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -288,8 +284,7 @@ options$selectedDesign2 <- list(list(levels = c("Row 0", "Row 1", "Row 2", "Row
options$selectedRow <- 0 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)


test_that("5.1 Nine Factor Two Level Frac. Factorial Design table results match", {
Expand Down Expand Up @@ -337,8 +332,7 @@ options$selectedRow <- 1 # select design
options$centerpoints <- 1
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("6.1 One Center Point Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -374,8 +368,7 @@ options$selectedRow <- 1 # select design
options$centerpoints <- 2
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)


test_that("7.1 Two Center Point Factorial Design table results match", {
Expand Down Expand Up @@ -412,8 +405,7 @@ options$selectedRow <- 1 # select design
options$centerpoints <- 4
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)


test_that("8.1 Four Center Point Factorial Design table results match", {
Expand Down Expand Up @@ -453,8 +445,7 @@ options$selectedRow <- 1 # select design
options$blocks <- "2"
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("9.1 Two Blocks Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -490,8 +481,7 @@ options$selectedRow <- 1 # select design
options$blocks <- "4"
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("10.1 Four Blocks Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -527,8 +517,7 @@ options$selectedRow <- 1 # select design
options$blocks <- "8"
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("11.1 Eight Blocks Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -570,8 +559,7 @@ options$selectedDesign2 <- list(list(levels = "Row 0", name = "data 1", values =
options$selectedRow <- 0 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("12.1 Two Factor One HTC Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -605,8 +593,7 @@ options$selectedDesign2 <- list(list(levels = "Row 0", name = "data 1", values =
options$selectedRow <- 1 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("13.1 Five Factor Two HTC Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -653,8 +640,7 @@ options$selectedDesign2 <- list(list(levels = "Row 0", name = "data 1", values =
options$selectedRow <- 1 # select design
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("14.1 Seven Factor Three HTC Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -756,8 +742,7 @@ options$factorialType <- "generalFullFactorial"
options$runOrder <- "runOrderStandard"
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("15.1 Three Factor Three Level General Full Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -797,8 +782,7 @@ options$factorialType <- "generalFullFactorial"
options$runOrder <- "runOrderStandard"
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("16.1 Three Factor Four Level General Full Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down Expand Up @@ -842,8 +826,7 @@ options$factorialType <- "generalFullFactorial"
options$runOrder <- "runOrderStandard"
options$setSeed <- TRUE
set.seed(1)
dataset <- NULL
results <- runAnalysis("doeFactorial", dataset, options)
results <- runAnalysis("doeFactorial", "debug.csv", options)

test_that("17.1 Four Factor Six Level General Full Factorial Design table results match", {
table <- results[["results"]][["displayDesign"]][["data"]]
Expand Down
30 changes: 10 additions & 20 deletions tests/testthat/test-doeResponseSurfaceMethodology.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ options$selectedDesign2 <- list( # give design list, always five lists, number o
list(levels = c("Row 0", "Row 1"), name = "data 5", values = c(1.682, 1.633)) # alpha
)
options$selectedRow <- 1 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)

test_that("1.1 Three Cont. Pred. Central Composite Design table results match", {
table <- results[["results"]][["designTable"]][["data"]]
Expand Down Expand Up @@ -79,8 +78,7 @@ options$selectedDesign2 <- list( # give design list, always five lists, number o
list(levels = c("Row 0", "Row 1"), name = "data 5", values = c(2.378, 2.366)) # alpha
)
options$selectedRow <- 1 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)

test_that("2.1 Five Cont. Pred. Central Composite Design table results match", {
table <- results[["results"]][["designTable"]][["data"]]
Expand Down Expand Up @@ -150,8 +148,7 @@ options$selectedDesign2 <- list( # give design list, always five lists, number o
list(levels = c("Row 0", "Row 1"), name = "data 5", values = c(1.682, 1.633)) # alpha
)
options$selectedRow <- 1 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)


test_that("3.1 Three Cont. Pred. Two. Disc. Pred. Central Composite Design table results match", {
Expand Down Expand Up @@ -239,8 +236,7 @@ options$selectedDesign2 <- list( # give design list, always five lists, number o
list(levels = c("Row 0", "Row 1"), name = "data 5", values = c(2, 2)) # alpha
)
options$selectedRow <- 1 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)


test_that("4.1 Four Cont. Pred. One. Disc. Pred. Central Composite Design table results match", {
Expand Down Expand Up @@ -310,8 +306,7 @@ options$selectedDesign2 <- list( # give design list, always five lists, number o
)
options$selectedRow <- 1 # select design
options$alphaType <- "faceCentered"
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)

test_that("5.1 Three Cont. Pred. Face Centered Central Composite Design table results match", {
table <- results[["results"]][["designTable"]][["data"]]
Expand Down Expand Up @@ -358,8 +353,7 @@ options$selectedDesign2 <- list( # give design list, always five lists, number o
)
options$selectedRow <- 1 # select design
options$alphaType <- "faceCentered"
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)



Expand Down Expand Up @@ -414,8 +408,7 @@ options$selectedDesign2 <- list( # give design list, always three lists, number
list(levels = c("Row 0"), name = "data 3", values = c(3)) # centre points
)
options$selectedRow <- 0 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)

test_that("7.1 Three Cont. Pred. Box-Behnken Design table results match", {
table <- results[["results"]][["designTable"]][["data"]]
Expand Down Expand Up @@ -461,8 +454,7 @@ options$selectedDesign2 <- list( # give design list, always three lists, number
list(levels = c("Row 0"), name = "data 3", values = c(3)) # centre points
)
options$selectedRow <- 0 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)


test_that("8.1 Four Cont. Pred. Box-Behnken Design table results match", {
Expand Down Expand Up @@ -516,8 +508,7 @@ options$selectedDesign2 <- list( # give design list, always three lists, number
list(levels = c("Row 0"), name = "data 3", values = c(3)) # centre points
)
options$selectedRow <- 0 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)

test_that("9.1 Five Cont. Pred. Box-Behnken Design table results match", {
table <- results[["results"]][["designTable"]][["data"]]
Expand Down Expand Up @@ -582,8 +573,7 @@ options$selectedDesign2 <- list( # give design list, always three lists, number
list(levels = c("Row 0"), name = "data 3", values = c(6)) # centre points
)
options$selectedRow <- 0 # select design
dataset <- NULL
results <- runAnalysis("doeResponseSurfaceMethodology", dataset, options)
results <- runAnalysis("doeResponseSurfaceMethodology", "debug.csv", options)


test_that("10.1 Six Cont. Pred. One Disc. Pred. Box-Behnken Design table results match", {
Expand Down

0 comments on commit 072ca77

Please sign in to comment.