Skip to content

Commit 156d6e2

Browse files
committed
ci: indexing, test csv output first
1 parent b362df9 commit 156d6e2

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

tests/testthat/test-read_chroms.R

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ path_uv <- "testdata/dad1.uv" #chemstation 131
55

66
x <- read_chroms(path_csv, format_in = "chemstation_csv", progress_bar = FALSE)[[1]]
77

8+
test_that("chromconverter can read `Agilent Chemstation` csv file", {
9+
expect_equal(dim(x), c(1944, 1))
10+
expect_equal(head(x[,1], n = 3), c(-4.086018, -4.113674, -4.142761),
11+
tolerance = .0001, ignore_attr = TRUE)
12+
expect_equal(head(rownames(x), n = 3), c("0.002", "0.0086666666667",
13+
"0.0153333333333"))
14+
15+
})
16+
817
test_that("Aston parser can read `Agilent Chemstation` 131 files", {
918
skip_if_missing_dependencies()
1019
skip_if_not(file.exists(path_csv))
@@ -26,14 +35,13 @@ test_that("Aston parser can read `Agilent Chemstation` 131 files", {
2635

2736
x1 <- read_chroms(path_uv, format_in = "chemstation_uv", parser = "chromconverter",
2837
find_files = FALSE,
29-
read_metadata = TRUE, progress_bar = FALSE)
38+
read_metadata = TRUE, progress_bar = FALSE)[[1]]
3039

3140
test_that("read_chemstation_uv parser can read chemstation 131 files", {
32-
expect_equal(as.numeric(x[[1]][,1]), as.numeric(x1[[1]][,"220"]))
33-
expect_equal(as.numeric(rownames(x[[1]])), as.numeric(rownames(x1[[1]])))
34-
expect_equal(length(x1), length(path_uv))
35-
expect_equal(class(x1[[1]])[1], "matrix")
36-
expect_equal(attr(x1[[1]], "data_format"), "wide")
41+
expect_equal(as.numeric(x[,1]), as.numeric(x1[,"220"]))
42+
expect_equal(as.numeric(rownames(x)), as.numeric(rownames(x1)))
43+
expect_equal(class(x1)[1], "matrix")
44+
expect_equal(attr(x1, "data_format"), "wide")
3745
})
3846

3947
test_that("extract_metadata function works", {
@@ -51,13 +59,13 @@ test_that("entab parser can read `Agilent Chemstation` 131 files", {
5159

5260
x1 <- read_chroms(file, format_in = "chemstation_uv", parser = "entab",
5361
find_files = FALSE,
54-
read_metadata = TRUE, progress_bar = FALSE)
62+
read_metadata = TRUE, progress_bar = FALSE)[[1]]
5563

56-
expect_equal(as.numeric(x[[1]][,1]), as.numeric(x1[[1]][,"220"]))
57-
expect_equal(as.numeric(rownames(x[[1]])), as.numeric(rownames(x1[[1]])))
58-
expect_equal(class(x1[[1]])[1], "matrix")
59-
expect_equal(attr(x1[[1]], "parser"), "entab")
60-
expect_equal(attr(x1[[1]], "data_format"), "wide")
64+
expect_equal(as.numeric(x[,1]), as.numeric(x1[,"220"]))
65+
expect_equal(as.numeric(rownames(x)), as.numeric(rownames(x1)))
66+
expect_equal(class(x1)[1], "matrix")
67+
expect_equal(attr(x1, "parser"), "entab")
68+
expect_equal(attr(x1, "data_format"), "wide")
6169
})
6270

6371
test_that("Shimadzu ascii parser works", {

0 commit comments

Comments
 (0)