Skip to content

Commit

Permalink
Merge pull request #3694 from rcurtin/r-verbose-test
Browse files Browse the repository at this point in the history
Test "verbose" option for R.
  • Loading branch information
rcurtin committed Apr 29, 2024
2 parents 3f77098 + ed77e91 commit 8af7aae
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/mlpack/bindings/R/mlpack/tests/testthat/test-R_binding.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,23 @@ test_that("TestSerialization", {

expect_true(output2$model_bw_out == 20)
})

# Make sure that the verbose argument does anything at all.
test_that("TestVerbose", {
expect_output(test_r_binding(4.0, 12, "hello",
build_model=TRUE,
verbose=TRUE))
})

# Test that we get no output when verbose output is disabled.
test_that("TestNotVerbose", {
expect_silent(test_r_binding(4.0, 12, "hello",
build_model=TRUE))
})

# Test that we get no output when verbose output is explicitly disabled.
test_that("TestReallyNotVerbose", {
expect_silent(test_r_binding(4.0, 12, "hello",
build_model=TRUE,
verbose=FALSE))
})
3 changes: 3 additions & 0 deletions src/mlpack/bindings/R/tests/test_r_binding_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,7 @@ void BINDING_FUNCTION(util::Params& params, util::Timers& /* timers */)
params.Get<double>("model_bw_out") =
params.Get<GaussianKernel*>("model_in")->Bandwidth() * 2.0;
}

// Provide some output if the user asked for it.
Log::Info << "Here is some verbose output!" << std::endl;
}

0 comments on commit 8af7aae

Please sign in to comment.