Skip to content

Commit

Permalink
Merge pull request #360 from WeberJulia/enhancement-test_to_gtest
Browse files Browse the repository at this point in the history
updated test_hypercube to gtest_hypercube
  • Loading branch information
Davknapp authored Nov 18, 2022
2 parents ba7e029 + c763cc6 commit a861ab8
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 74 deletions.
1 change: 1 addition & 0 deletions doc/author_weber.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I place my contributions to t8code under the FreeBSD license. Julia Weber ([email protected])
6 changes: 3 additions & 3 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
t8code_test_programs = \
test/t8_cmesh/t8_test_cmesh_copy \
test/t8_cmesh/t8_test_cmesh_partition \
test/t8_cmesh/t8_test_hypercube \
test/t8_cmesh/t8_test_cmesh_face_is_boundary \
test/t8_cmesh/t8_test_cmesh_readmshfile \
test/t8_forest/t8_test_find_owner \
Expand All @@ -29,7 +28,7 @@ t8code_test_programs = \
test/t8_test_netcdf_linkage \
test/t8_test_vtk_linkage

test_t8_cmesh_t8_test_hypercube_SOURCES = test/t8_cmesh/t8_test_hypercube.c

test_t8_cmesh_t8_test_cmesh_copy_SOURCES = test/t8_cmesh/t8_test_cmesh_copy.c
test_t8_cmesh_t8_test_cmesh_partition_SOURCES = test/t8_cmesh/t8_test_cmesh_partition.cxx
test_t8_cmesh_t8_test_cmesh_face_is_boundary_SOURCES = test/t8_cmesh/t8_test_cmesh_face_is_boundary.cxx
Expand Down Expand Up @@ -75,7 +74,8 @@ test_t8_gtest_main_SOURCES = test/t8_gtest_main.cxx \
test/t8_gtest_version.cxx \
test/t8_schemes/t8_gtest_init_linear_id.cxx \
test/t8_gtest_basics.cxx \
test/t8_schemes/t8_gtest_ancestor.cxx
test/t8_schemes/t8_gtest_ancestor.cxx \
test/t8_cmesh/t8_gtest_hypercube.cxx

test_t8_gtest_main_LDADD = $(LDADD) test/libgtest.la
test_t8_gtest_main_LDFLAGS = $(AM_LDFLAGS) -pthread
Expand Down
63 changes: 63 additions & 0 deletions test/t8_cmesh/t8_gtest_hypercube.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
This file is part of t8code.
t8code is a C library to manage a collection (a forest) of multiple
connected adaptive space-trees of general element classes in parallel.
Copyright (C) 2015 the developers
t8code is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
t8code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with t8code; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/* This gtest checks whether a cmesh of a hypercube is commited and wheter for each tree is face consistent in respect to
* the creation of the cmesh with or without broadcast/ partition. */

#include <gtest/gtest.h>
#include <t8_cmesh.h>
#include "t8_cmesh/t8_cmesh_trees.h"
#include <t8_cmesh/t8_cmesh_examples.h>

/* *INDENT-OFF* */
/* Create class for parameterized Test with multiple test parameters */
class cmesh_hypercube_trees : public testing::TestWithParam<std::tuple<t8_eclass,int,int>>{
protected:
/* SetUp the test parameters (eclass, bcast and partition) and define the test value cmesh. */
void SetUp() override {
eclass = std::get<0>(GetParam());
bcast = std::get<1>(GetParam());
partition = std::get<2>(GetParam());

cmesh = t8_cmesh_new_hypercube(eclass, sc_MPI_COMM_WORLD, bcast, partition, 0);
}
void TearDown() override {
t8_cmesh_unref(&cmesh);
}

t8_cmesh_t cmesh;
t8_eclass eclass;
int bcast;
int partition;
};

/* Test wheater the created cmesh of a hypercube is commited and its are face consistend. Test will fail, if one of these ist false. */
TEST_P (cmesh_hypercube_trees, check_cmesh_and_its_trees) {

EXPECT_TRUE(t8_cmesh_is_committed (cmesh));
EXPECT_TRUE(t8_cmesh_trees_is_face_consistend (cmesh, cmesh->trees));
}

/* Use the testing range for eclass with [T8_ECLASS_ZERO, T8_ECLASS_COUNT]. For the generation of the cmesh with or withaout broadcast
* the booleans 0 and 1 are used. Analogue with patition. */
INSTANTIATE_TEST_SUITE_P(t8_gtest_hypercube, cmesh_hypercube_trees, testing::Combine(testing::Range(T8_ECLASS_ZERO, T8_ECLASS_COUNT),testing::Values(0,1),testing::Values(0,1)));
/* *INDENT-ON* */
71 changes: 0 additions & 71 deletions test/t8_cmesh/t8_test_hypercube.c

This file was deleted.

0 comments on commit a861ab8

Please sign in to comment.