mirror of
https://github.com/eclipse-openvehicle-api/openvehicle-api.git
synced 2026-04-18 10:38:16 +00:00
72 lines
1.9 KiB
C++
72 lines
1.9 KiB
C++
/********************************************************************************
|
|
* Copyright (c) 2025-2026 ZF Friedrichshafen AG
|
|
*
|
|
* This program and the accompanying materials are made available under the
|
|
* terms of the Apache License Version 2.0 which is available at
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Contributors:
|
|
* Erik Verhoeven - initial API and implementation
|
|
********************************************************************************/
|
|
|
|
#ifndef GTEST_CUSTOM_H
|
|
#define GTEST_CUSTOM_H
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma warning(disable: 4102)
|
|
#endif
|
|
|
|
#define GTEST_HAS_EXCEPTIONS 1
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <iostream>
|
|
#include <algorithm>
|
|
#include <math.h>
|
|
|
|
#ifndef countof
|
|
/**
|
|
* @brief Count the amount of elements in the array.
|
|
* @tparam T Array base type.
|
|
* @tparam N The amount of elements.
|
|
* @return The amount of elements in the array.
|
|
*/
|
|
template <typename T, int N>
|
|
constexpr int countof(T const (&)[N]) noexcept
|
|
{
|
|
return N;
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* @brief Equality test macro for container functions.
|
|
*/
|
|
#define EXPECT_ARREQ(val1, ...) { bool b = val1 == decltype(val1)({__VA_ARGS__}); EXPECT_TRUE(b); }
|
|
|
|
/**
|
|
* @brief Unequality test macro for container functions.
|
|
*/
|
|
#define EXPECT_ARRNE(val1, ...) { bool b = val1 == decltype(val1)({__VA_ARGS__}); EXPECT_FALSE(b); }
|
|
|
|
/**
|
|
* @brief Check for equality fo floating point values.
|
|
*/
|
|
#define EXPECT_FPEQ(val1, val2) EXPECT_TRUE(std::fabs(val1 - val2) < std::numeric_limits<decltype(val1)>::epsilon());
|
|
|
|
#include "simple_cpp_decomposer.h"
|
|
|
|
/**
|
|
* @brief Compare CPP code for equality.
|
|
*/
|
|
#define EXPECT_CPPEQ(s1, s2) \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperCPPEQ, s1, s2)
|
|
|
|
/**
|
|
* @brief Compare CPP code for inequality.
|
|
*/
|
|
#define EXPECT_CPPNE(s1, s2) \
|
|
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperCPPNE, s1, s2)
|
|
|
|
|
|
#endif // ! defined GTEST_CUSTOM_H
|