-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(unit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# CMakeLists.txt | ||
cmake_minimum_required(VERSION 3.10) | ||
project(unit_tests) | ||
|
||
# Set the source files | ||
set(SRC_FILES | ||
main.cpp | ||
# List the test headers (they are included in main.cpp) | ||
#test_function1.h | ||
#test_function2.h | ||
# Add more test headers here | ||
) | ||
|
||
# Include directories from your main codebase | ||
include_directories( | ||
${PROJECT_SOURCE_DIR}/../../src # Adjust the path as needed | ||
# Include other directories if necessary | ||
) | ||
|
||
# Find and include any required packages | ||
# find_package(PackageName REQUIRED) | ||
# include_directories(${PackageName_INCLUDE_DIRS}) | ||
|
||
# Add the executable | ||
add_executable(unit_test ${SRC_FILES}) | ||
|
||
# Link against your main codebase library (if available) | ||
# add_subdirectory(${PROJECT_SOURCE_DIR}/../../src ${CMAKE_BINARY_DIR}/src) | ||
# target_link_libraries(unit_test artemis_library_name) | ||
|
||
# If your codebase is not a library, you might need to include source files directly | ||
# target_sources(unit_test PRIVATE ${PROJECT_SOURCE_DIR}/../../src/your_source.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//======================================================================================== | ||
// (C) (or copyright) 2023-2024. Triad National Security, LLC. All rights reserved. | ||
// | ||
// This program was produced under U.S. Government contract 89233218CNA000001 for Los | ||
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC | ||
// for the U.S. Department of Energy/National Nuclear Security Administration. All rights | ||
// in the program are reserved by Triad National Security, LLC, and the U.S. Department | ||
// of Energy/National Nuclear Security Administration. The Government is granted for | ||
// itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide | ||
// license in this material to reproduce, prepare derivative works, distribute copies to | ||
// the public, perform publicly and display publicly, and to permit others to do so. | ||
//======================================================================================== | ||
|
||
// This code was generated in whole or in part by one of OpenAI's generative AI models. | ||
|
||
#include <functional> | ||
#include <iostream> | ||
#include <map> | ||
#include <string> | ||
|
||
// Temporary testing | ||
void test_function1() {} | ||
void test_function2() {} | ||
|
||
int main(int argc, char *argv[]) { | ||
// Map of test names to test functions | ||
std::map<std::string, std::function<void()>> tests = { | ||
{"test1", test_function1}, {"test2", test_function2}, | ||
// Add more test mappings here | ||
}; | ||
|
||
if (argc == 1) { | ||
// No test name provided, run all tests | ||
for (const auto &test : tests) { | ||
std::cout << "Running " << test.first << "..." << std::endl; | ||
test.second(); | ||
} | ||
} else { | ||
// Run specified test(s) | ||
for (int i = 1; i < argc; ++i) { | ||
std::string test_name = argv[i]; | ||
auto it = tests.find(test_name); | ||
if (it != tests.end()) { | ||
std::cout << "Running " << test_name << "..." << std::endl; | ||
it->second(); | ||
} else { | ||
std::cerr << "Test \"" << test_name << "\" not found." << std::endl; | ||
} | ||
} | ||
} | ||
|
||
return 0; | ||
} |