Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Checks: >
cert-oop58-cpp,
concurrency-*,
cppcoreguidelines-*,
google-*,
llvm-include-order,
llvm-namespace-comment,
misc-*,
Expand Down
18 changes: 10 additions & 8 deletions modules/performance/tests/perf_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include "task/include/task.hpp"
#include "util/include/util.hpp"

using namespace ppc::task;
using ppc::task::StatusOfTask;
using ppc::task::Task;
using ppc::task::TypeOfTask;

namespace ppc::test {

Expand Down Expand Up @@ -63,7 +65,7 @@ class FakePerfTask : public TestPerfTask<InType, OutType> {

namespace ppc::performance {

TEST(perf_tests, check_perf_pipeline) {
TEST(PerfTests, CheckPerfPipeline) {
std::vector<uint32_t> in(2000, 1);

auto test_task = std::make_shared<ppc::test::TestPerfTask<std::vector<uint32_t>, uint32_t>>(in);
Expand All @@ -78,7 +80,7 @@ TEST(perf_tests, check_perf_pipeline) {
EXPECT_EQ(test_task->GetOutput(), in.size());
}

TEST(perf_tests, check_perf_pipeline_float) {
TEST(PerfTests, CheckPerfPipelineFloat) {
std::vector<float> in(2000, 1);

auto test_task = std::make_shared<ppc::test::TestPerfTask<std::vector<float>, float>>(in);
Expand All @@ -93,7 +95,7 @@ TEST(perf_tests, check_perf_pipeline_float) {
EXPECT_EQ(test_task->GetOutput(), in.size());
}

TEST(perf_tests, check_perf_pipeline_uint8_t_slow_test) {
TEST(PerfTests, CheckPerfPipelineUint8tSlowTest) {
std::vector<uint8_t> in(128, 1);

auto test_task = std::make_shared<ppc::test::FakePerfTask<std::vector<uint8_t>, uint8_t>>(in);
Expand All @@ -114,7 +116,7 @@ TEST(perf_tests, check_perf_pipeline_uint8_t_slow_test) {
ASSERT_ANY_THROW(perf_analyzer.PrintPerfStatistic("check_perf_pipeline_uint8_t_slow_test"));
}

TEST(perf_tests, slow_perf_respects_env_override) {
TEST(PerfTests, SlowPerfRespectsEnvOverride) {
env::detail::set_scoped_environment_variable scoped("PPC_PERF_MAX_TIME", "12");
std::vector<uint8_t> in(128, 1);
auto test_task = std::make_shared<ppc::test::FakePerfTask<std::vector<uint8_t>, uint8_t>>(in);
Expand All @@ -131,7 +133,7 @@ TEST(perf_tests, slow_perf_respects_env_override) {
EXPECT_NO_THROW(perf_analyzer.PrintPerfStatistic("slow_perf_respects_env_override"));
}

TEST(perf_tests, check_perf_task_exception) {
TEST(PerfTests, CheckPerfTaskException) {
std::vector<uint32_t> in(2000, 1);

auto test_task = std::make_shared<ppc::test::TestPerfTask<std::vector<uint32_t>, uint32_t>>(in);
Expand All @@ -144,7 +146,7 @@ TEST(perf_tests, check_perf_task_exception) {
perf_analyzer.TaskRun(perf_attr);
}

TEST(perf_tests, check_perf_task_float) {
TEST(PerfTests, CheckPerfTaskFloat) {
std::vector<float> in(2000, 1);

auto test_task = std::make_shared<ppc::test::TestPerfTask<std::vector<float>, float>>(in);
Expand Down Expand Up @@ -385,7 +387,7 @@ TEST(PerfTest, GetStringParamNameTest) {
EXPECT_EQ(GetStringParamName(PerfResults::TypeOfRunning::kNone), "none");
}

TEST(TaskTest, Destructor_InvalidPipelineOrderTerminates_PartialPipeline) {
TEST(TaskTest, DestructorInvalidPipelineOrderTerminatesPartialPipeline) {
{
struct BadTask : Task<int, int> {
bool ValidationImpl() override {
Expand Down
45 changes: 24 additions & 21 deletions modules/task/tests/task_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
#include "task/include/task.hpp"
#include "util/include/util.hpp"

using namespace ppc::task;
using ppc::task::StateOfTesting;
using ppc::task::StatusOfTask;
using ppc::task::Task;
using ppc::task::TypeOfTask;

class ScopedFile {
public:
Expand Down Expand Up @@ -76,7 +79,7 @@ class FakeSlowTask : public TestTask<InType, OutType> {

} // namespace ppc::test

TEST(task_tests, check_int32_t) {
TEST(TaskTests, CheckInt32t) {
std::vector<int32_t> in(20, 1);
ppc::test::TestTask<std::vector<int32_t>, int32_t> test_task(in);
ASSERT_EQ(test_task.Validation(), true);
Expand All @@ -86,7 +89,7 @@ TEST(task_tests, check_int32_t) {
ASSERT_EQ(static_cast<size_t>(test_task.GetOutput()), in.size());
}

TEST(task_tests, check_int32_t_slow) {
TEST(TaskTests, CheckInt32tSlow) {
std::vector<int32_t> in(20, 1);
ppc::test::FakeSlowTask<std::vector<int32_t>, int32_t> test_task(in);
ASSERT_EQ(test_task.Validation(), true);
Expand All @@ -95,7 +98,7 @@ TEST(task_tests, check_int32_t_slow) {
ASSERT_ANY_THROW(test_task.PostProcessing());
}

TEST(task_tests, slow_task_respects_env_override) {
TEST(TaskTests, SlowTaskRespectsEnvOverride) {
env::detail::set_scoped_environment_variable scoped("PPC_TASK_MAX_TIME", "3");
std::vector<int32_t> in(20, 1);
ppc::test::FakeSlowTask<std::vector<int32_t>, int32_t> test_task(in);
Expand All @@ -105,7 +108,7 @@ TEST(task_tests, slow_task_respects_env_override) {
EXPECT_NO_THROW(test_task.PostProcessing());
}

TEST(task_tests, check_validate_func) {
TEST(TaskTests, CheckValidateFunc) {
std::vector<int32_t> in;
ppc::test::TestTask<std::vector<int32_t>, int32_t> test_task(in);
ASSERT_EQ(test_task.Validation(), false);
Expand All @@ -114,7 +117,7 @@ TEST(task_tests, check_validate_func) {
test_task.PostProcessing();
}

TEST(task_tests, check_double) {
TEST(TaskTests, CheckDouble) {
std::vector<double> in(20, 1);
ppc::test::TestTask<std::vector<double>, double> test_task(in);
ASSERT_EQ(test_task.Validation(), true);
Expand All @@ -124,7 +127,7 @@ TEST(task_tests, check_double) {
EXPECT_NEAR(test_task.GetOutput(), static_cast<double>(in.size()), 1e-6);
}

TEST(task_tests, check_float) {
TEST(TaskTests, CheckFloat) {
std::vector<float> in(20, 1);
ppc::test::TestTask<std::vector<float>, float> test_task(in);
ASSERT_EQ(test_task.Validation(), true);
Expand All @@ -134,40 +137,40 @@ TEST(task_tests, check_float) {
EXPECT_NEAR(test_task.GetOutput(), in.size(), 1e-3);
}

TEST(task_tests, check_wrong_order_disabled_valgrind) {
TEST(TaskTests, CheckWrongOrderDisabledValgrind) {
std::vector<float> in(20, 1);
ppc::test::TestTask<std::vector<float>, float> test_task(in);
ASSERT_EQ(test_task.Validation(), true);
test_task.PreProcessing();
EXPECT_THROW(test_task.PostProcessing(), std::runtime_error);
}

TEST(task_tests, premature_postprocessing_no_steps) {
TEST(TaskTests, PrematurePostprocessingNoSteps) {
std::vector<float> in(20, 1);
ppc::test::TestTask<std::vector<float>, float> test_task(in);
EXPECT_THROW(test_task.PostProcessing(), std::runtime_error);
}

TEST(task_tests, premature_postprocessing_after_preprocessing) {
TEST(TaskTests, PrematurePostprocessingAfterPreprocessing) {
std::vector<float> in(20, 1);
ppc::test::TestTask<std::vector<float>, float> test_task(in);
EXPECT_THROW(test_task.PreProcessing(), std::runtime_error);
EXPECT_THROW(test_task.PostProcessing(), std::runtime_error);
}

TEST(TaskTest, GetStringTaskStatus_Disabled) {
TEST(TaskTest, GetStringTaskStatusDisabled) {
EXPECT_EQ(GetStringTaskStatus(StatusOfTask::kDisabled), "disabled");
}

TEST(TaskTest, GetStringTaskStatus_Enabled) {
TEST(TaskTest, GetStringTaskStatusEnabled) {
EXPECT_EQ(GetStringTaskStatus(StatusOfTask::kEnabled), "enabled");
}

TEST(TaskTest, GetStringTaskType_InvalidFileThrows) {
TEST(TaskTest, GetStringTaskTypeInvalidFileThrows) {
EXPECT_THROW({ GetStringTaskType(TypeOfTask::kALL, "non_existing_file.json"); }, std::runtime_error);
}

TEST(TaskTest, GetStringTaskType_UnknownType_WithValidFile) {
TEST(TaskTest, GetStringTaskTypeUnknownTypeWithValidFile) {
std::string path = "settings_valid.json";
ScopedFile cleaner(path);
std::ofstream file(path);
Expand All @@ -177,7 +180,7 @@ TEST(TaskTest, GetStringTaskType_UnknownType_WithValidFile) {
EXPECT_NO_THROW({ GetStringTaskType(TypeOfTask::kUnknown, path); });
}

TEST(TaskTest, GetStringTaskType_ThrowsOnBadJSON) {
TEST(TaskTest, GetStringTaskTypeThrowsOnBadJSON) {
std::string path = "bad_settings.json";
ScopedFile cleaner(path);
std::ofstream file(path);
Expand All @@ -186,7 +189,7 @@ TEST(TaskTest, GetStringTaskType_ThrowsOnBadJSON) {
EXPECT_THROW({ GetStringTaskType(TypeOfTask::kALL, path); }, std::exception);
}

TEST(TaskTest, GetStringTaskType_EachType_WithValidFile) {
TEST(TaskTest, GetStringTaskTypeEachTypeWithValidFile) {
std::string path = "settings_valid_all.json";
ScopedFile cleaner(path);
std::ofstream file(path);
Expand All @@ -202,7 +205,7 @@ TEST(TaskTest, GetStringTaskType_EachType_WithValidFile) {
EXPECT_NO_THROW(GetStringTaskType(TypeOfTask::kSEQ, path));
}

TEST(TaskTest, GetStringTaskType_ReturnsUnknown_OnDefault) {
TEST(TaskTest, GetStringTaskTypeReturnsUnknownOnDefault) {
std::string path = "settings_valid_unknown.json";
ScopedFile cleaner(path);
std::ofstream file(path);
Expand All @@ -213,7 +216,7 @@ TEST(TaskTest, GetStringTaskType_ReturnsUnknown_OnDefault) {
EXPECT_EQ(result, "unknown");
}

TEST(TaskTest, GetStringTaskType_ThrowsIfKeyMissing) {
TEST(TaskTest, GetStringTaskTypeThrowsIfKeyMissing) {
std::string path = "settings_partial.json";
ScopedFile cleaner(path);
std::ofstream file(path);
Expand All @@ -223,7 +226,7 @@ TEST(TaskTest, GetStringTaskType_ThrowsIfKeyMissing) {
EXPECT_ANY_THROW(GetStringTaskType(TypeOfTask::kSTL, path));
}

TEST(TaskTest, TaskDestructor_ThrowsIfStageIncomplete) {
TEST(TaskTest, TaskDestructorThrowsIfStageIncomplete) {
{
std::vector<int32_t> in(20, 1);
struct LocalTask : Task<std::vector<int32_t>, int32_t> {
Expand All @@ -249,7 +252,7 @@ TEST(TaskTest, TaskDestructor_ThrowsIfStageIncomplete) {
ppc::util::DestructorFailureFlag::Unset();
}

TEST(TaskTest, TaskDestructor_ThrowsIfEmpty) {
TEST(TaskTest, TaskDestructorThrowsIfEmpty) {
{
std::vector<int32_t> in(20, 1);
struct LocalTask : Task<std::vector<int32_t>, int32_t> {
Expand All @@ -274,7 +277,7 @@ TEST(TaskTest, TaskDestructor_ThrowsIfEmpty) {
ppc::util::DestructorFailureFlag::Unset();
}

TEST(TaskTest, InternalTimeTest_ThrowsIfTimeoutExceeded) {
TEST(TaskTest, InternalTimeTestThrowsIfTimeoutExceeded) {
struct SlowTask : Task<std::vector<int32_t>, int32_t> {
explicit SlowTask(const std::vector<int32_t>& in) {
this->GetInput() = in;
Expand Down
8 changes: 4 additions & 4 deletions modules/util/tests/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace my::nested {
struct Type {};
} // namespace my::nested

TEST(util_tests, extracts_correct_namespace) {
TEST(UtilTests, ExtractsCorrectNamespace) {
std::string k_ns = ppc::util::GetNamespace<my::nested::Type>();
EXPECT_EQ(k_ns, "my::nested");
}

TEST(util_tests, threads_control_check_openmp_disabled_valgrind) {
TEST(UtilTests, ThreadsControlCheckOpenmpDisabledValgrind) {
const auto num_threads_env_var = env::get<int>("PPC_NUM_THREADS");

EXPECT_EQ(ppc::util::GetNumThreads(), omp_get_max_threads());
Expand All @@ -34,12 +34,12 @@ TEST(GetNamespaceTest, ReturnsExpectedNamespace) {
EXPECT_EQ(k_ns, "test_ns");
}

TEST(GetNamespaceTest, ReturnsEmptyIfNoNamespace_PrimitiveType) {
TEST(GetNamespaceTest, ReturnsEmptyIfNoNamespacePrimitiveType) {
std::string k_ns = ppc::util::GetNamespace<int>();
EXPECT_EQ(k_ns, "");
}

TEST(GetNamespaceTest, ReturnsEmptyIfNoNamespace_PlainStruct) {
TEST(GetNamespaceTest, ReturnsEmptyIfNoNamespacePlainStruct) {
std::string k_ns = ppc::util::GetNamespace<PlainType>();
EXPECT_EQ(k_ns, "");
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def run_core(self):
shlex.split(self.valgrind_cmd)
+ [str(self.work_dir / "core_func_tests")]
+ self.__get_gtest_settings(1, "*")
+ ["--gtest_filter=*:-*_disabled_valgrind"]
+ ["--gtest_filter=*:-*DisabledValgrind"]
)

self.__run_exec(
Expand Down
Loading