TTS v3.0.0
The Tiny Test System
 
Loading...
Searching...
No Matches
Relation Tests Macros

Macros for performing relation checks. More...

Runtime Relation Checks

#define TTS_BIT_EQUAL(LHS, RHS, ...)
 Performs equality comparison between the bits of two expressions.
 
#define TTS_BIT_NOT_EQUAL(LHS, RHS, ...)
 Performs inequality comparison between the bits of two expressions.
 
#define TTS_EQUAL(LHS, RHS, ...)
 Performs equality comparison between two expressions.
 
#define TTS_NOT_EQUAL(LHS, RHS, ...)
 Performs inequality comparison between two expressions.
 
#define TTS_LESS(LHS, RHS, ...)
 Performs less-than comparison between two expressions.
 
#define TTS_GREATER(LHS, RHS, ...)
 Performs greater-than comparison between two expressions.
 
#define TTS_LESS_EQUAL(LHS, RHS, ...)
 Performs less-or-equal-than comparison between two expressions.
 
#define TTS_GREATER_EQUAL(LHS, RHS, ...)
 Performs greater-or-equal-than comparison between two expressions.
 

Runtime Typed Relation Checks

#define TTS_TYPED_EQUAL(LHS, RHS, ...)
 Performs type and equality comparison between two expressions.
 
#define TTS_TYPED_NOT_EQUAL(LHS, RHS, ...)
 Performs type and equality comparison between two expressions.
 
#define TTS_TYPED_LESS(LHS, RHS, ...)
 Performs type and equality comparison between two expressions.
 
#define TTS_TYPED_GREATER(LHS, RHS, ...)
 Performs type and equality comparison between two expressions.
 
#define TTS_TYPED_LESS_EQUAL(LHS, RHS, ...)
 Performs type and equality comparison between two expressions.
 
#define TTS_TYPED_GREATER_EQUAL(LHS, RHS, ...)
 Performs type and equality comparison between two expressions.
 

Constexpr Relation Checks

#define TTS_CONSTEXPR_EQUAL(LHS, RHS, ...)
 Performs equality comparison between two expressions at compile-time.
 
#define TTS_CONSTEXPR_NOT_EQUAL(LHS, RHS, ...)
 Performs inequality comparison between two expressions at compile-time.
 
#define TTS_CONSTEXPR_LESS(LHS, RHS, ...)
 Performs less-than comparison between two expressions at compile-time.
 
#define TTS_CONSTEXPR_GREATER(LHS, RHS, ...)
 Performs greater-than comparison between two expressions at compile-time.
 
#define TTS_CONSTEXPR_LESS_EQUAL(LHS, RHS, ...)
 Performs less-or-equal-than comparison between two expressions at compile-time.
 
#define TTS_CONSTEXPR_GREATER_EQUAL(LHS, RHS, ...)
 Performs greater-or-equal-than comparison between two expressions at compile-time.
 

Macro Definition Documentation

◆ TTS_BIT_EQUAL

#define TTS_BIT_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs equality comparison between the bits of two expressions.

This comparison is performed by using memcmp on the underlying representation of both expressions.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of bitwise equality tests")
{
TTS_BIT_EQUAL(1.f, 0x3F800000);
TTS_BIT_EQUAL(1., 0x3FF0000000000000ULL);
// This test would cause the program to stop with a failure.
// TTS_BIT_EQUAL(12, 21, REQUIRED);
};
#define TTS_BIT_EQUAL(LHS, RHS,...)
Performs equality comparison between the bits of two expressions.
Definition relation.hpp:92
#define TTS_CASE(ID)
Introduces a new test scenario and registers it into the current test driver.
Definition case.hpp:139

◆ TTS_BIT_NOT_EQUAL

#define TTS_BIT_NOT_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs inequality comparison between the bits of two expressions.

This comparison is performed by using memcmp on the underlying representation of both expressions.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of bitwise inequality tests")
{
TTS_BIT_NOT_EQUAL(1.f, 0x3F80F700);
TTS_BIT_NOT_EQUAL(2., 0x3FF0000000000000ULL);
// This test would cause the program to stop with a failure.
// TTS_BIT_NOT_EQUAL(21, 21, REQUIRED);
};
#define TTS_BIT_NOT_EQUAL(LHS, RHS,...)
Performs inequality comparison between the bits of two expressions.
Definition relation.hpp:112

◆ TTS_CONSTEXPR_EQUAL

#define TTS_CONSTEXPR_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs equality comparison between two expressions at compile-time.

This comparison is performed by using the proper operator== overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of constexpr equality tests")
{
constexpr float a = 45.f;
constexpr int b = 45;
};
#define TTS_CONSTEXPR_EQUAL(LHS, RHS,...)
Performs equality comparison between two expressions at compile-time.
Definition relation.hpp:442

◆ TTS_CONSTEXPR_GREATER

#define TTS_CONSTEXPR_GREATER (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs greater-than comparison between two expressions at compile-time.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of constexpr greater-than tests")
{
constexpr int a = 45;
constexpr float b = 4.5f;
};
#define TTS_CONSTEXPR_GREATER(LHS, RHS,...)
Performs greater-than comparison between two expressions at compile-time.
Definition relation.hpp:506

◆ TTS_CONSTEXPR_GREATER_EQUAL

#define TTS_CONSTEXPR_GREATER_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs greater-or-equal-than comparison between two expressions at compile-time.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of constexpr less-or-equal-than tests")
{
constexpr int a = 45;
constexpr float b = 4.5f;
};
#define TTS_CONSTEXPR_GREATER_EQUAL(LHS, RHS,...)
Performs greater-or-equal-than comparison between two expressions at compile-time.
Definition relation.hpp:550

◆ TTS_CONSTEXPR_LESS

#define TTS_CONSTEXPR_LESS (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs less-than comparison between two expressions at compile-time.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of constexpr less-than tests")
{
constexpr float a = 4.5f;
constexpr int b = 45;
};
#define TTS_CONSTEXPR_LESS(LHS, RHS,...)
Performs less-than comparison between two expressions at compile-time.
Definition relation.hpp:485

◆ TTS_CONSTEXPR_LESS_EQUAL

#define TTS_CONSTEXPR_LESS_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs less-or-equal-than comparison between two expressions at compile-time.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of constexpr less-or-equal-than tests")
{
constexpr float a = 4.5f;
constexpr int b = 45;
};
#define TTS_CONSTEXPR_LESS_EQUAL(LHS, RHS,...)
Performs less-or-equal-than comparison between two expressions at compile-time.
Definition relation.hpp:528

◆ TTS_CONSTEXPR_NOT_EQUAL

#define TTS_CONSTEXPR_NOT_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs inequality comparison between two expressions at compile-time.

This comparison is performed by using the proper operator== overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
TTS_CASE("Check correctness of constexpr equality tests")
{
constexpr float a = 4.5f;
constexpr int b = 45;
};
#define TTS_CONSTEXPR_NOT_EQUAL(LHS, RHS,...)
Performs inequality comparison between two expressions at compile-time.
Definition relation.hpp:463

◆ TTS_EQUAL

#define TTS_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs equality comparison between two expressions.

This comparison is performed by using the proper operator== overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of equality tests")
{
TTS_EQUAL(45, 45.f);
std::vector<float> a {1, 2, 3}, b {1, 2, 3};
TTS_EQUAL(a, b);
// This test would cause the program to stop with a failure.
// TTS_EQUAL(12, 21, REQUIRED);
};
#define TTS_EQUAL(LHS, RHS,...)
Performs equality comparison between two expressions.
Definition relation.hpp:134

◆ TTS_GREATER

#define TTS_GREATER (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs greater-than comparison between two expressions.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of greater-than comparison tests")
{
TTS_GREATER(69., 42ULL);
std::vector<float> a {13, 5}, b {2, 4, 6};
TTS_GREATER(a, b);
// This test will cause the program to stop with a failure
// TTS_GREATER(1., 10., REQUIRED);
};
#define TTS_GREATER(LHS, RHS,...)
Performs greater-than comparison between two expressions.
Definition relation.hpp:197

◆ TTS_GREATER_EQUAL

#define TTS_GREATER_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs greater-or-equal-than comparison between two expressions.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of greater-equal comparison tests")
{
TTS_GREATER_EQUAL(69LL, 42.f);
std::vector<float> a {12, 3}, b {7, 9, 11};
// This test would cause the program to stop with a failure
// TTS_GREATER_EQUAL(1., 10., REQUIRED);
};
#define TTS_GREATER_EQUAL(LHS, RHS,...)
Performs greater-or-equal-than comparison between two expressions.
Definition relation.hpp:239

◆ TTS_LESS

#define TTS_LESS (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs less-than comparison between two expressions.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of less-than comparison tests")
{
TTS_LESS(42., 69);
std::vector<float> a {1, 2, 3}, b {12, 3};
TTS_LESS(a, b);
// This test would cause the program to stop with a failure
// TTS_LESS(69, 42, REQUIRED);
};
#define TTS_LESS(LHS, RHS,...)
Performs less-than comparison between two expressions.
Definition relation.hpp:176

◆ TTS_LESS_EQUAL

#define TTS_LESS_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs less-or-equal-than comparison between two expressions.

This comparison is performed by using the proper operator< overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of less-equal comparison tests")
{
TTS_LESS_EQUAL(42., 69);
TTS_LESS_EQUAL(69., 69);
std::vector<float> a {1, 2, 3}, b {7, 9};
// This test would cause the program to stop with a failure
// TTS_LESS_EQUAL(10., 1., REQUIRED);
};
#define TTS_LESS_EQUAL(LHS, RHS,...)
Performs less-or-equal-than comparison between two expressions.
Definition relation.hpp:218

◆ TTS_NOT_EQUAL

#define TTS_NOT_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs inequality comparison between two expressions.

This comparison is performed by using the proper operator== overload or by a custom comparison.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of inequality tests")
{
TTS_NOT_EQUAL(42, 69.f);
std::vector<float> a {1, 2, 3}, b {7, 9};
// This test would cause the program to stop with a failure
// TTS_NOT_EQUAL('A', 65, REQUIRED);
};
#define TTS_NOT_EQUAL(LHS, RHS,...)
Performs inequality comparison between two expressions.
Definition relation.hpp:155

◆ TTS_TYPED_EQUAL

#define TTS_TYPED_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs type and equality comparison between two expressions.

This test behaves as TTS_EQUAL but also verify that both arguments's types are the same.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of type checked equality tests")
{
TTS_TYPED_EQUAL(45, 45.f);
std::vector<float> a {1, 2, 3}, b {1, 2, 3};
};
#define TTS_TYPED_EQUAL(LHS, RHS,...)
Performs type and equality comparison between two expressions.
Definition relation.hpp:296

◆ TTS_TYPED_GREATER

#define TTS_TYPED_GREATER (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs type and equality comparison between two expressions.

This test behaves as TTS_GREATER but also verify that both arguments's types are the same.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of type checked greater-than comparison tests")
{
TTS_TYPED_GREATER(69., 42ULL);
TTS_TYPED_GREATER(69., 42.);
std::vector<float> a {13, 5}, b {2, 4, 6};
};
#define TTS_TYPED_GREATER(LHS, RHS,...)
Performs type and equality comparison between two expressions.
Definition relation.hpp:357

◆ TTS_TYPED_GREATER_EQUAL

#define TTS_TYPED_GREATER_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs type and equality comparison between two expressions.

This test behaves as TTS_GREATER_EQUAL but also verify that both arguments's types are the same.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of type checked greater-equal comparison tests")
{
std::vector<float> a {12, 3}, b {7, 9, 11};
};
#define TTS_TYPED_GREATER_EQUAL(LHS, RHS,...)
Performs type and equality comparison between two expressions.
Definition relation.hpp:398

◆ TTS_TYPED_LESS

#define TTS_TYPED_LESS (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs type and equality comparison between two expressions.

This test behaves as TTS_LESS but also verify that both arguments's types are the same.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of type checked less-than comparison tests")
{
TTS_TYPED_LESS(42., 69.);
TTS_TYPED_LESS(42., 69);
std::vector<float> a {1, 2, 3}, b {12, 3};
};
#define TTS_TYPED_LESS(LHS, RHS,...)
Performs type and equality comparison between two expressions.
Definition relation.hpp:337

◆ TTS_TYPED_LESS_EQUAL

#define TTS_TYPED_LESS_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs type and equality comparison between two expressions.

This test behaves as TTS_LESS_EQUAL but also verify that both arguments's types are the same.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of type checked less-equal comparison tests")
{
TTS_TYPED_LESS_EQUAL(42.f, 69LL);
TTS_TYPED_LESS_EQUAL(42.f, 69.f);
std::vector<float> a {1, 2, 3}, b {79, 11};
};
#define TTS_TYPED_LESS_EQUAL(LHS, RHS,...)
Performs type and equality comparison between two expressions.
Definition relation.hpp:377

◆ TTS_TYPED_NOT_EQUAL

#define TTS_TYPED_NOT_EQUAL (   LHS,
  RHS,
  ... 
)

#include <tts/test/relation.hpp>

Performs type and equality comparison between two expressions.

This test behaves as TTS_NOT_EQUAL but also verify that both arguments's types are the same.

Parameters
LHS,RHSExpressions to compare.
...Optional tag. If equals to REQUIRED, this test will stop the program if it fails.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE("Check correctness of type checked non-equality tests")
{
std::vector<float> a {1, 2, 3}, b {7, 9};
};
#define TTS_TYPED_NOT_EQUAL(LHS, RHS,...)
Performs type and equality comparison between two expressions.
Definition relation.hpp:316