Skip to content

add tests #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
schochastics opened this issue Feb 10, 2023 · 1 comment
Closed

add tests #3

schochastics opened this issue Feb 10, 2023 · 1 comment

Comments

@schochastics
Copy link

Add some unit tests. You do note need to have 100% coverage but a few tests would be nice to have

This is part of the review for JOSS openjournals/joss-reviews#5143

@schochastics
Copy link
Author

Several tests are failing

R> devtools::test()
ℹ Testing discourseGT
Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2| F W S  OK | Context|         3 | basicPlot| 1       5 | basicPlot [1.4s]
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Failure (test_basicPlot.R:27): basicPlot works
`basicPlot(...)` did not produce any warnings.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✖ | 1       0 | coreNetAnalysis                                                                                                                                   
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Error (test_coreNetAnalysis.R:14): (code run outside of `test_that()`)
Error in `data.frame(master)`: object 'master' not found
Backtrace:
 1. discourseGT::prepareGraphs(raw_data_input, project_title)
      at test_coreNetAnalysis.R:14:0
 3. base::with.default(raw_data_input, data.frame(master))
 4. base::eval(substitute(expr), data, enclos = parent.frame())
 5. base::eval(substitute(expr), data, enclos = parent.frame())
 6. base::data.frame(master)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✖ | 1       0 | plot1Att                                                                                                                                          
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Error (test_plot1Att.R:21): (code run outside of `test_that()`)
Error in `data.frame(master)`: object 'master' not found
Backtrace:
 1. discourseGT::prepareGraphs(raw_data_input, project_title)
      at test_plot1Att.R:21:0
 3. base::with.default(raw_data_input, data.frame(master))
 4. base::eval(substitute(expr), data, enclos = parent.frame())
 5. base::eval(substitute(expr), data, enclos = parent.frame())
 6. base::data.frame(master)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✖ | 1       0 | plot2Att                                                                                                                                          
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Error (test_plot2Att.R:22): (code run outside of `test_that()`)
Error in `data.frame(master)`: object 'master' not found
Backtrace:
 1. discourseGT::prepareGraphs(raw_data_input, project_title)
      at test_plot2Att.R:22:0
 3. base::with.default(raw_data_input, data.frame(master))
 4. base::eval(substitute(expr), data, enclos = parent.frame())
 5. base::eval(substitute(expr), data, enclos = parent.frame())
 6. base::data.frame(master)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✖ | 3      12 | prepareGraphs                                                                                                                                     
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Failure (test_prepareGraphs.R:18): prepareGraphs works
all.equal(result$edge_list, edge_list[, c("source", "target")]) is not TRUE

`actual` is a character vector ('Names: 2 string mismatches')
`expected` is a logical vector (TRUE)

Failure (test_prepareGraphs.R:20): prepareGraphs works
result$weight_list not equal to edge_list$weight.
Modes: list, numeric
names for target but not for current
Attributes: < Modes: list, NULL >
Attributes: < names for target but not for current >
Attributes: < current is not list-like >
Length mismatch: comparison on first 1 components
Component 1: Numeric: lengths (9, 1) differ

Failure (test_prepareGraphs.R:28): prepareGraphs works
all.equal(result$edge_list, edge_list[, c("source", "target")]) is not TRUE

`actual` is a character vector ('Names: 2 string mismatches')
`expected` is a logical vector (TRUE)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

══ Results ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 1.7 s

[ FAIL 7 | WARN 0 | SKIP 0 | PASS 17 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant