Skip to content

Commit

Permalink
Adding reading .cub file
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilot committed Dec 21, 2023
1 parent 9aa1e6e commit cbab5bc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Build
run: cd build && make -j
- name: Perform unit tests
run: cd build && OMP_NUM_THREADS=1 make test # suppress parallel sections for tests
run: cd build && make test
- name: Perform code coverage
run: |
cd build
Expand Down
2 changes: 1 addition & 1 deletion src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ endif()

# add unpacking of dataset to the test suite
add_test(NAME DatasetSetup COMMAND tar -xvjf dataset.tar.bz2)
add_test(NAME DatasetCleanup COMMAND rm -rvf CHGCAR_* PARCHG_*)
add_test(NAME DatasetCleanup COMMAND rm -rvf CHGCAR_* PARCHG_* *.d2o *.cub)
set_tests_properties(DatasetSetup PROPERTIES FIXTURES_SETUP Dataset)
set_tests_properties(DatasetCleanup PROPERTIES FIXTURES_CLEANUP Dataset)

Expand Down
7 changes: 6 additions & 1 deletion src/test/test_scalarfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void TestScalarField::setUp() {
void TestScalarField::tearDown() {
}

void TestScalarField::testReading() {
void TestScalarField::testReadingCHGCAR() {
// create scalar field
ScalarField sf("CHGCAR_CH4", ScalarFieldInputFileType::SFF_CHGCAR);
CPPUNIT_ASSERT_EQUAL( (uint)0, sf.get_size() );
Expand Down Expand Up @@ -90,3 +90,8 @@ void TestScalarField::testReading() {
sf.get_value_interp(0.0,0.0,10.0),
1e-12);
}

void TestScalarField::testReadingCUB() {
// test reading sf file
ScalarField sf("co_2pi_x.cub", ScalarFieldInputFileType::SFF_CUB);
}
7 changes: 4 additions & 3 deletions src/test/test_scalarfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
class TestScalarField : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( TestScalarField );
CPPUNIT_TEST( testReading );
CPPUNIT_TEST( testReadingCHGCAR );
CPPUNIT_TEST( testReadingCUB );
CPPUNIT_TEST_SUITE_END();

public:
void setUp();
void tearDown();

void testReading();
void testD2OFileFormat();
void testReadingCHGCAR();
void testReadingCUB();

private:
};
Expand Down
Binary file removed src/test/testinput/ch4.d2o
Binary file not shown.
Binary file modified src/test/testinput/dataset.tar.bz2
Binary file not shown.

0 comments on commit cbab5bc

Please sign in to comment.