-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable test diagnostic prints by default (#238)
- Loading branch information
Showing
18 changed files
with
188 additions
and
66 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
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,25 @@ | ||
// Copyright (c) Sleipnir contributors | ||
|
||
#pragma once | ||
|
||
#include <span> | ||
#include <string_view> | ||
|
||
/// Test commandline argument that enables solver diagnostics | ||
inline constexpr std::string_view kEnableDiagnostics = "--enable-diagnostics"; | ||
|
||
/** | ||
* Initializes the commandline argument list for tests to retreive. | ||
*/ | ||
void SetCmdlineArgs(char* argv[], int argc); | ||
|
||
/** | ||
* Returns the test executable's commandline arguments. | ||
*/ | ||
std::span<char*> GetCmdlineArgs(); | ||
|
||
/** | ||
* Returns true if the given argument is present in the test executable's | ||
* commandline arguments. | ||
*/ | ||
bool CmdlineArgPresent(std::string_view arg); |
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,21 @@ | ||
// Copyright (c) Sleipnir contributors | ||
|
||
#include "CmdlineArguments.hpp" | ||
|
||
#include <algorithm> | ||
|
||
namespace { | ||
static std::span<char*> args; | ||
} // namespace | ||
|
||
void SetCmdlineArgs(char* argv[], int argc) { | ||
args = std::span(argv, argc); | ||
} | ||
|
||
std::span<char*> GetCmdlineArgs() { | ||
return args; | ||
} | ||
|
||
bool CmdlineArgPresent(std::string_view arg) { | ||
return std::find(args.begin(), args.end(), arg) != args.end(); | ||
} |
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,13 @@ | ||
// Copyright (c) Sleipnir contributors | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "CmdlineArguments.hpp" | ||
|
||
int main(int argc, char* argv[]) { | ||
testing::InitGoogleTest(&argc, argv); | ||
|
||
SetCmdlineArgs(argv, argc); | ||
|
||
return RUN_ALL_TESTS(); | ||
} |
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
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
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
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
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
Oops, something went wrong.