Skip to content

Commit

Permalink
Add getter for Courierr instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaya-mankad committed Mar 14, 2023
1 parent 70cad02 commit fbfa886
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/btwxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class RegularGridInterpolator {

void set_logger(std::shared_ptr<Courierr::Courierr> logger);

Courierr::Courierr& get_logger() { return *btwxt_logger; };

private:
friend class TwoDFixtureWithLoggingContext;
friend class TwoDFixtureWithLoggingContext_set_message_context_Test;
Expand Down
8 changes: 8 additions & 0 deletions test/btwxt_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ TEST_F(TwoDFixture, unique_logger_per_rgi_instance) {
EXPECT_STDOUT(test_rgi.set_new_target(short_target);, expected_error); // Recheck
}

TEST_F(TwoDFixture, access_logger_in_btwxt) {
RegularGridInterpolator rgi2(test_gridded_data, std::make_shared<BtwxtContextCourierr>());
std::string context_str{"RGI2 Context:"};
rgi2.get_logger().set_message_context(reinterpret_cast<void *>(&context_str));
std::string expected_error2{"RGI2 Context: ERROR: Target and Gridded Data do not have the same dimensions.\n"};
EXPECT_STDOUT(rgi2.set_new_target({1});, expected_error2);
}

//TODO: Test that logger copies in GriddedData/GridPoint also receive modified context

TEST_F(OneDFixture, cubic_interpolate) {
Expand Down

0 comments on commit fbfa886

Please sign in to comment.