41 lines
755 B
C++
41 lines
755 B
C++
|
|
#include <catch2/catch.hpp>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
#include "../utils.hpp"
|
||
|
|
#include "../AutomaticDifferentiation.hpp"
|
||
|
|
|
||
|
|
#define print(x) PRINT_VAR(x);
|
||
|
|
#define printstr(x) PRINT_STR(x);
|
||
|
|
|
||
|
|
template<typename T>
|
||
|
|
bool check_almost_equal(const std::vector<T> & v1, const std::vector<T> & v2, T tol)
|
||
|
|
{
|
||
|
|
bool ok = true;
|
||
|
|
for(size_t i = 0 ; i < v1.size() ; i++)
|
||
|
|
if(fabs(v1[i] - v2[i]) > tol)
|
||
|
|
{
|
||
|
|
ok = false;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
return ok;
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST_CASE( "Dual numbers : Constructors", "[dual]" )
|
||
|
|
{
|
||
|
|
std::cout.precision(16);
|
||
|
|
using S = double;
|
||
|
|
using D = Dual<S>;
|
||
|
|
using V = std::vector<S>;
|
||
|
|
|
||
|
|
SECTION( "Default Constructor" ) {
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
SECTION( "Constructor with int" ) {
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// CHECK()
|
||
|
|
// REQUIRE()
|