-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bringing together all the complex<> regression suites into a consiste…
…nt build flow
- Loading branch information
1 parent
99f13b9
commit 4efbc00
Showing
14 changed files
with
275 additions
and
16 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,109 @@ | ||
// addition.cpp: test suite runner for complex addition on classic floats | ||
// | ||
// Copyright (C) 2017 Stillwater Supercomputing, Inc. | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This file is part of the universal numbers project, which is released under an MIT Open Source license. | ||
#include <universal/utility/directives.hpp> | ||
// minimum set of include files to reflect source code dependencies | ||
#define BLOCKTRIPLE_VERBOSE_OUTPUT | ||
//#define BLOCKTRIPLE_TRACE_ADD | ||
#define TRACE_CONVERSION 0 | ||
#include <universal/number/cfloat/cfloat.hpp> | ||
#include <universal/verification/test_status.hpp> | ||
#include <universal/verification/test_case.hpp> | ||
#include <universal/verification/test_suite_randoms.hpp> | ||
#include <universal/verification/cfloat_test_suite.hpp> | ||
|
||
// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override | ||
#define MANUAL_TESTING 0 | ||
// REGRESSION_LEVEL_OVERRIDE is set by the cmake file to drive a specific regression intensity | ||
// It is the responsibility of the regression test to organize the tests in a quartile progression. | ||
//#undef REGRESSION_LEVEL_OVERRIDE | ||
#ifndef REGRESSION_LEVEL_OVERRIDE | ||
#undef REGRESSION_LEVEL_1 | ||
#undef REGRESSION_LEVEL_2 | ||
#undef REGRESSION_LEVEL_3 | ||
#undef REGRESSION_LEVEL_4 | ||
#define REGRESSION_LEVEL_1 1 | ||
#define REGRESSION_LEVEL_2 1 | ||
#define REGRESSION_LEVEL_3 1 | ||
#define REGRESSION_LEVEL_4 1 | ||
#endif | ||
|
||
int main() | ||
try { | ||
using namespace sw::universal; | ||
|
||
// cfloat encoding configuration for the test | ||
constexpr bool hasSubnormals = true; | ||
constexpr bool hasSupernormals = false; | ||
constexpr bool isSaturating = false; | ||
|
||
std::string test_suite = "classic cfloat complex addition validation"; | ||
std::string test_tag = "cfloat_fff addition"; | ||
bool reportTestCases = true; | ||
int nrOfFailedTestCases = 0; | ||
|
||
ReportTestSuiteHeader(test_suite, reportTestCases); | ||
|
||
// shorthand alias types | ||
using c16 = cfloat< 16, 5, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
using c32 = cfloat< 32, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
using c48 = cfloat< 48, 8, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
using c64 = cfloat< 64, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
using c80 = cfloat< 80, 11, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
using c96 = cfloat< 96, 15, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
using c128 = cfloat<128, 15, uint8_t, hasSubnormals, hasSupernormals, isSaturating>; | ||
|
||
// driving the intensity of the randomized arithmetic tests | ||
size_t nrRandoms = 0; | ||
|
||
#if MANUAL_TESTING | ||
|
||
|
||
ReportTestSuiteResults(test_suite, nrOfFailedTestCases); | ||
return EXIT_SUCCESS; // ignore failures | ||
|
||
#else | ||
|
||
#if REGRESSION_LEVEL_1 | ||
|
||
#endif | ||
|
||
#if REGRESSION_LEVEL_2 | ||
|
||
#endif | ||
|
||
#if REGRESSION_LEVEL_3 | ||
|
||
#endif | ||
|
||
#if REGRESSION_LEVEL_4 | ||
|
||
#endif | ||
|
||
ReportTestSuiteResults(test_suite, nrOfFailedTestCases); | ||
return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); | ||
#endif // MANUAL_TESTING | ||
} | ||
catch (char const* msg) { | ||
std::cerr << "Caught ad-hoc exception: " << msg << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_arithmetic_exception& err) { | ||
std::cerr << "Caught unexpected universal arithmetic exception : " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_internal_exception& err) { | ||
std::cerr << "Caught unexpected universal internal exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const std::runtime_error& err) { | ||
std::cerr << "Caught runtime exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (...) { | ||
std::cerr << "Caught unknown exception" << std::endl; | ||
return EXIT_FAILURE; | ||
} |
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,110 @@ | ||
// functions.cpp: test suite runner for complex (real, imag, conj) functions | ||
// | ||
// Copyright (C) 2017 Stillwater Supercomputing, Inc. | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This file is part of the universal numbers project, which is released under an MIT Open Source license. | ||
#include <universal/utility/directives.hpp> | ||
// use default number system library configuration | ||
#include <universal/number/cfloat/cfloat.hpp> | ||
#include <universal/verification/test_reporters.hpp> | ||
|
||
// Regression testing guards: typically set by the cmake configuration, but MANUAL_TESTING is an override | ||
#define MANUAL_TESTING 0 | ||
// REGRESSION_LEVEL_OVERRIDE is set by the cmake file to drive a specific regression intensity | ||
// It is the responsibility of the regression test to organize the tests in a quartile progression. | ||
//#undef REGRESSION_LEVEL_OVERRIDE | ||
#ifndef REGRESSION_LEVEL_OVERRIDE | ||
#undef REGRESSION_LEVEL_1 | ||
#undef REGRESSION_LEVEL_2 | ||
#undef REGRESSION_LEVEL_3 | ||
#undef REGRESSION_LEVEL_4 | ||
#define REGRESSION_LEVEL_1 1 | ||
#define REGRESSION_LEVEL_2 1 | ||
#define REGRESSION_LEVEL_3 1 | ||
#define REGRESSION_LEVEL_4 1 | ||
#endif | ||
|
||
int main() | ||
try { | ||
using namespace sw::universal; | ||
|
||
std::string test_suite = "cfloat complex function validation"; | ||
std::string test_tag = "complex failed: "; | ||
bool reportTestCases = false; | ||
int nrOfFailedTestCases = 0; | ||
|
||
ReportTestSuiteHeader(test_suite, reportTestCases); | ||
|
||
#if MANUAL_TESTING | ||
|
||
// manual exhaustive test | ||
|
||
{ | ||
constexpr unsigned nbits = 8; | ||
constexpr unsigned es = 2; | ||
constexpr bool hasSubnormals = true; | ||
typedef uint8_t bt; | ||
using Real = cfloat<nbits, es, bt, hasSubnormals>; | ||
|
||
std::complex<Real> a, b, c; | ||
|
||
a.real = 1.0f; | ||
a.imag = 1.0f; | ||
} | ||
|
||
ReportTestSuiteResults(test_suite, nrOfFailedTestCases); | ||
return EXIT_SUCCESS; // ignore errors | ||
#else | ||
|
||
constexpr unsigned nbits = 8; | ||
constexpr unsigned es = 2; | ||
constexpr bool hasSubnormals = true; | ||
|
||
using Real = cfloat<nbits, es, uint8_t, hasSubnormals>; | ||
std::complex<Real> x, y; | ||
auto bla = std::complex<Real>(copysign(x.real(), y.real()), copysign(x.real(), y.real())); | ||
|
||
std::cout << bla << '\n'; | ||
|
||
#if REGRESSION_LEVEL_1 | ||
|
||
#endif | ||
|
||
#if REGRESSION_LEVEL_2 | ||
|
||
#endif | ||
|
||
#if REGRESSION_LEVEL_3 | ||
|
||
#endif | ||
|
||
#if REGRESSION_LEVEL_4 | ||
|
||
#endif | ||
|
||
ReportTestSuiteResults(test_suite, nrOfFailedTestCases); | ||
return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS); | ||
|
||
#endif // MANUAL_TESTING | ||
} | ||
catch (char const* msg) { | ||
std::cerr << "Caught ad-hoc exception: " << msg << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_arithmetic_exception& err) { | ||
std::cerr << "Caught unexpected universal arithmetic exception : " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const sw::universal::universal_internal_exception& err) { | ||
std::cerr << "Caught unexpected universal internal exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (const std::runtime_error& err) { | ||
std::cerr << "Caught runtime exception: " << err.what() << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
catch (...) { | ||
std::cerr << "Caught unknown exception" << std::endl; | ||
return EXIT_FAILURE; | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
static/posit/arithmetic/complex_add.cpp → static/posit/complex/arithmetic/addition.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
2 changes: 1 addition & 1 deletion
2
static/posit/math/complex.cpp → static/posit/complex/math/functions.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
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