build: satiate clang-tidy somewhat
This commit is contained in:
parent
becd1e24e3
commit
b61d55ee3c
@ -90,8 +90,9 @@ namespace cruft::adapter {
|
|||||||
public:
|
public:
|
||||||
using inner_type = typename std::iterator_traits<IteratorT>::value_type;
|
using inner_type = typename std::iterator_traits<IteratorT>::value_type;
|
||||||
|
|
||||||
using value_type = decltype (std::get<I> (std::declval<inner_type>));
|
using value_type = decltype (std::get<I> (std::declval<inner_type> ()));
|
||||||
using reference = value_type&;
|
using reference = value_type&;
|
||||||
|
using const_reference = value_type const&;
|
||||||
|
|
||||||
|
|
||||||
explicit scalar (IteratorT _inner):
|
explicit scalar (IteratorT _inner):
|
||||||
@ -99,7 +100,7 @@ namespace cruft::adapter {
|
|||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
const reference operator* (void) const&
|
const_reference operator* (void) const&
|
||||||
{ return std::get<I> (*m_inner); }
|
{ return std::get<I> (*m_inner); }
|
||||||
|
|
||||||
reference operator* (void)&
|
reference operator* (void)&
|
||||||
|
@ -25,7 +25,7 @@ linear::linear (cruft::view<u08*> _data):
|
|||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
linear::linear (linear &&rhs)
|
linear::linear (linear &&rhs) noexcept
|
||||||
: m_begin (std::exchange (rhs.m_begin, nullptr))
|
: m_begin (std::exchange (rhs.m_begin, nullptr))
|
||||||
, m_end (std::exchange (rhs.m_end, nullptr))
|
, m_end (std::exchange (rhs.m_end, nullptr))
|
||||||
, m_cursor (std::exchange (rhs.m_cursor, nullptr))
|
, m_cursor (std::exchange (rhs.m_cursor, nullptr))
|
||||||
@ -34,7 +34,7 @@ linear::linear (linear &&rhs)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
linear&
|
linear&
|
||||||
linear::operator= (linear &&rhs)
|
linear::operator= (linear &&rhs) noexcept
|
||||||
{
|
{
|
||||||
m_begin = std::exchange (rhs.m_begin, nullptr);
|
m_begin = std::exchange (rhs.m_begin, nullptr);
|
||||||
m_end = std::exchange (rhs.m_end, nullptr);
|
m_end = std::exchange (rhs.m_end, nullptr);
|
||||||
|
@ -25,8 +25,8 @@ namespace cruft::alloc {
|
|||||||
linear (const linear&) = delete;
|
linear (const linear&) = delete;
|
||||||
linear& operator= (const linear&) = delete;
|
linear& operator= (const linear&) = delete;
|
||||||
|
|
||||||
linear (linear&&);
|
linear (linear&&) noexcept;
|
||||||
linear& operator= (linear&&);
|
linear& operator= (linear&&) noexcept;
|
||||||
|
|
||||||
linear (cruft::view<u08*> _data);
|
linear (cruft::view<u08*> _data);
|
||||||
|
|
||||||
|
@ -3,12 +3,13 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* Copyright 2016-2018 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2016-2019 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "annotation.hpp"
|
#include "annotation.hpp"
|
||||||
|
#include "debug.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* Copyright 2012-2017 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2012-2019 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CRUFT_UTIL_COORD_BASE_HPP
|
#pragma once
|
||||||
#define CRUFT_UTIL_COORD_BASE_HPP
|
|
||||||
|
|
||||||
#include "fwd.hpp"
|
#include "fwd.hpp"
|
||||||
|
|
||||||
@ -254,4 +253,20 @@ namespace cruft::coord {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
/// Invoke a macro across all typical coordinate parameter combinations.
|
||||||
|
///
|
||||||
|
/// ie, each of the types i16, i32, i64, f32, and f64; and arities of 1, 2, 3,
|
||||||
|
/// and 4.
|
||||||
|
///
|
||||||
|
/// This is useful for exhaustive delayed instantiation in .cpp files.
|
||||||
|
|
||||||
|
#define MAP_CRUFT_COORD_PARAMS(F) \
|
||||||
|
F(1,i16) F(2,i16) F(3,i16) F(4,i16) \
|
||||||
|
F(1,i32) F(2,i32) F(3,i32) F(4,i32) \
|
||||||
|
F(1,i64) F(2,i64) F(3,i64) F(4,i64) \
|
||||||
|
F(1,u16) F(2,u16) F(3,u16) F(4,u16) \
|
||||||
|
F(1,u32) F(2,u32) F(3,u32) F(4,u32) \
|
||||||
|
F(1,u64) F(2,u64) F(3,u64) F(4,u64) \
|
||||||
|
F(1,f32) F(2,f32) F(3,f32) F(4,f32) \
|
||||||
|
F(1,f64) F(2,f64) F(3,f64) F(4,f64)
|
||||||
|
@ -93,9 +93,9 @@ namespace cruft::debug {
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#define INSTANTIATE_S_T(S,T) \
|
#define INSTANTIATE_S_T(S,T) \
|
||||||
template struct ::cruft::extent<S,T>; \
|
template struct ::cruft::extent<(S),T>; \
|
||||||
template bool ::cruft::debug::is_valid (const ::cruft::extent<S,T>&); \
|
template bool ::cruft::debug::is_valid (const ::cruft::extent<(S),T>&); \
|
||||||
template struct ::cruft::debug::validator<::cruft::extent<S,T>>;
|
template struct ::cruft::debug::validator<::cruft::extent<(S),T>>;
|
||||||
|
|
||||||
#define INSTANTIATE(T) \
|
#define INSTANTIATE(T) \
|
||||||
INSTANTIATE_S_T(1,T) \
|
INSTANTIATE_S_T(1,T) \
|
||||||
|
@ -60,9 +60,9 @@ struct cruft::debug::validator<ray<S,T>> {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INSTANTIATE_S_T(S,T) \
|
#define INSTANTIATE_S_T(S,T) \
|
||||||
template std::ostream& cruft::geom::operator<< (std::ostream&, ray<S,T>); \
|
template std::ostream& cruft::geom::operator<< (std::ostream&, ray<(S),T>); \
|
||||||
template struct cruft::debug::validator<ray<S,T>>; \
|
template struct cruft::debug::validator<ray<(S),T>>; \
|
||||||
template struct cruft::geom::ray<S,T>;
|
template struct cruft::geom::ray<(S),T>;
|
||||||
|
|
||||||
|
|
||||||
INSTANTIATE_S_T(2,float)
|
INSTANTIATE_S_T(2,float)
|
||||||
|
@ -86,11 +86,13 @@ murmur2<DigestT>::operator() (cruft::view<const uint8_t*> data) const noexcept
|
|||||||
{
|
{
|
||||||
static_assert (std::is_same_v<DigestT,uint32_t> || std::is_same_v<DigestT,uint64_t>);
|
static_assert (std::is_same_v<DigestT,uint32_t> || std::is_same_v<DigestT,uint64_t>);
|
||||||
|
|
||||||
if constexpr (std::is_same_v<DigestT,uint32_t>)
|
if constexpr (std::is_same_v<DigestT,uint32_t>) {
|
||||||
return hash_32 (data.data (), data.size (), m_seed);
|
return hash_32 (data.data (), data.size (), m_seed);
|
||||||
|
}
|
||||||
|
|
||||||
if constexpr (std::is_same_v<DigestT,uint64_t>)
|
if constexpr (std::is_same_v<DigestT,uint64_t>) {
|
||||||
return hash_64 (data.data (), data.size (), m_seed);
|
return hash_64 (data.data (), data.size (), m_seed);
|
||||||
|
}
|
||||||
|
|
||||||
unreachable ();
|
unreachable ();
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ read_le (const void *ptr)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct constants {
|
struct constants {
|
||||||
static const T prime[5];
|
static const T prime[5];
|
||||||
static const T round_rotate;
|
|
||||||
static const T final_rotate[3];
|
static const T final_rotate[3];
|
||||||
|
static const T round_rotate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
36
point.cpp
36
point.cpp
@ -9,6 +9,7 @@
|
|||||||
#include "point.hpp"
|
#include "point.hpp"
|
||||||
|
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
|
#include "std.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@ -58,27 +59,16 @@ cruft::furthest (cruft::view<const cruft::point<S,T>*> src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
#define INSTANTIATE_S_T(S,T) \
|
||||||
|
template struct cruft::point<(S),T>; \
|
||||||
|
template bool cruft::debug::is_valid (const point<(S),T>&); \
|
||||||
|
template std::pair< \
|
||||||
|
cruft::point<(S),T>, \
|
||||||
|
cruft::point<(S),T> \
|
||||||
|
> cruft::furthest (cruft::view<const cruft::point<(S),T>*>); \
|
||||||
|
template struct cruft::debug::validator<point<(S),T>>;
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#define INSTANTIATE_S_T(S,T) \
|
MAP_CRUFT_COORD_PARAMS(INSTANTIATE_S_T)
|
||||||
template struct cruft::point<S,T>; \
|
|
||||||
template bool cruft::debug::is_valid (const point<S,T>&); \
|
|
||||||
template std::pair<cruft::point<S,T>,cruft::point<S,T>> cruft::furthest (cruft::view<const cruft::point<S,T>*>); \
|
|
||||||
template struct cruft::debug::validator<point<S,T>>;
|
|
||||||
|
|
||||||
#define INSTANTIATE(T) \
|
|
||||||
INSTANTIATE_S_T(1,T) \
|
|
||||||
INSTANTIATE_S_T(2,T) \
|
|
||||||
INSTANTIATE_S_T(3,T) \
|
|
||||||
INSTANTIATE_S_T(4,T)
|
|
||||||
|
|
||||||
|
|
||||||
INSTANTIATE(int16_t)
|
|
||||||
INSTANTIATE(int32_t)
|
|
||||||
INSTANTIATE(int64_t)
|
|
||||||
|
|
||||||
INSTANTIATE(uint16_t)
|
|
||||||
INSTANTIATE(uint32_t)
|
|
||||||
INSTANTIATE(uint64_t)
|
|
||||||
|
|
||||||
INSTANTIATE(float)
|
|
||||||
INSTANTIATE(double)
|
|
||||||
|
@ -102,9 +102,12 @@ template <typename T>
|
|||||||
rational<T>
|
rational<T>
|
||||||
rational<T>::reduced (void) const
|
rational<T>::reduced (void) const
|
||||||
{
|
{
|
||||||
|
if (n == 0) {
|
||||||
|
return { 0, 1 };
|
||||||
|
}
|
||||||
|
|
||||||
CHECK_NEZ (d);
|
CHECK_NEZ (d);
|
||||||
auto x = std::gcd (abs (n), abs (d));
|
auto x = std::gcd (abs (n), abs (d));
|
||||||
|
|
||||||
return { n / x, d / x };
|
return { n / x, d / x };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
38
tap.hpp
38
tap.hpp
@ -3,13 +3,13 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Danny Robson <danny@nerdcruft.net>
|
* Copyright 2015-2019 Danny Robson <danny@nerdcruft.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CRUFT_UTIL_TAP_HPP
|
#pragma once
|
||||||
#define CRUFT_UTIL_TAP_HPP
|
|
||||||
|
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
|
#include "except.hpp"
|
||||||
#include "format.hpp"
|
#include "format.hpp"
|
||||||
#include "maths.hpp"
|
#include "maths.hpp"
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ namespace cruft::TAP {
|
|||||||
logger& operator= (logger const &) = delete;
|
logger& operator= (logger const &) = delete;
|
||||||
logger& operator= (logger &&) = delete;
|
logger& operator= (logger &&) = delete;
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
template <typename ...Args, size_t N>
|
template <typename ...Args, size_t N>
|
||||||
bool
|
bool
|
||||||
@ -223,6 +224,35 @@ namespace cruft::TAP {
|
|||||||
int status [[nodiscard]] (void) const;
|
int status [[nodiscard]] (void) const;
|
||||||
|
|
||||||
|
|
||||||
|
/// Invoke a FunctionT with a TAP::logger as the first argument, and
|
||||||
|
/// the remainder forwarded from the provided parameter pack.
|
||||||
|
///
|
||||||
|
/// If an exception escapes from the FunctionT the logger will be
|
||||||
|
/// marked as failed, using a message that attempts to use the raised
|
||||||
|
/// exception value (else a static generic message if the type isn't
|
||||||
|
/// easily discoverable).
|
||||||
|
///
|
||||||
|
/// Returns the status of the logger provided to the FunctionT.
|
||||||
|
template <typename FunctionT, typename ...Args>
|
||||||
|
static auto
|
||||||
|
run [[nodiscard]] (FunctionT &&function, Args&&...args) noexcept
|
||||||
|
{
|
||||||
|
logger tap;
|
||||||
|
try {
|
||||||
|
function (tap, args...);
|
||||||
|
return tap.status ();
|
||||||
|
} catch (std::exception const &err) {
|
||||||
|
tap.fail ("no exceptions: %s", err.what ());
|
||||||
|
} catch (cruft::error const &err) {
|
||||||
|
tap.fail ("no exceptions: %s", err);
|
||||||
|
} catch (...) {
|
||||||
|
tap.fail ("no exceptions");
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
mutable int m_reported = -1;
|
mutable int m_reported = -1;
|
||||||
@ -233,5 +263,3 @@ namespace cruft::TAP {
|
|||||||
size_t m_size;
|
size_t m_size;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -20,16 +20,16 @@ main (int, char**)
|
|||||||
tap.expect_eq (val.capacity (), decltype(val)::elements, "static vs dynamic query for capacity");
|
tap.expect_eq (val.capacity (), decltype(val)::elements, "static vs dynamic query for capacity");
|
||||||
|
|
||||||
{
|
{
|
||||||
auto const sum = std::accumulate (val.cbegin (), val.cend (), 0u);
|
auto const sum = std::accumulate (val.cbegin (), val.cend (), 0);
|
||||||
tap.expect_eq (sum, 28u, "accumulate over initializer_list range");
|
tap.expect_eq (sum, 28, "accumulate over initializer_list range");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
val.erase (val.begin () + 2);
|
val.erase (val.begin () + 2);
|
||||||
tap.expect_eq (val.size (), 7u, "erasing removes one element");
|
tap.expect_eq (val.size (), 7u, "erasing removes one element");
|
||||||
|
|
||||||
auto const sum = std::accumulate (val.cbegin (), val.cend (), 0u);
|
auto const sum = std::accumulate (val.cbegin (), val.cend (), 0);
|
||||||
tap.expect_eq (sum, 26u, "erase one element");
|
tap.expect_eq (sum, 26, "erase one element");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -39,8 +39,8 @@ main (int, char**)
|
|||||||
// Perform an accumulate to check the rest of the values are there too.
|
// Perform an accumulate to check the rest of the values are there too.
|
||||||
val.insert (val.begin () + 4, 13);
|
val.insert (val.begin () + 4, 13);
|
||||||
tap.expect_eq (val[4], 13, "inserted values matches indexed value");
|
tap.expect_eq (val[4], 13, "inserted values matches indexed value");
|
||||||
auto const sum = std::accumulate (val.cbegin (), val.cend (), 0u);
|
auto const sum = std::accumulate (val.cbegin (), val.cend (), 0);
|
||||||
tap.expect_eq (sum, 39u, "accumulate over new array suggests all still present");
|
tap.expect_eq (sum, 39, "accumulate over new array suggests all still present");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
int
|
int
|
||||||
main (int, char**)
|
main (int, char**)
|
||||||
{
|
{
|
||||||
cruft::TAP::logger tap;
|
|
||||||
|
|
||||||
static constexpr bool T = true;
|
static constexpr bool T = true;
|
||||||
static constexpr bool F = false;
|
static constexpr bool F = false;
|
||||||
|
|
||||||
@ -49,26 +47,26 @@ main (int, char**)
|
|||||||
{ '\n', F, F, F, F, T, 0, 0, "newline" },
|
{ '\n', F, F, F, F, T, 0, 0, "newline" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return cruft::TAP::logger::run ([] (auto &tap) {
|
||||||
#define TRY_BOOL(X) [&] () -> bool { try { return X; } catch (...) { return false; }; } ()
|
#define TRY_BOOL(X) [&] () -> bool { try { return X; } catch (...) { return false; }; } ()
|
||||||
|
|
||||||
for (auto &t: TESTS) {
|
for (auto &t: TESTS) {
|
||||||
bool is_digit = TRY_BOOL(cruft::ascii::is_digit (t.character)) == t.is_digit;
|
bool is_digit = TRY_BOOL(cruft::ascii::is_digit (t.character)) == t.is_digit;
|
||||||
bool is_hex = TRY_BOOL(cruft::ascii::is_hex (t.character)) == t.is_hex;
|
bool is_hex = TRY_BOOL(cruft::ascii::is_hex (t.character)) == t.is_hex;
|
||||||
bool is_upper = TRY_BOOL(cruft::ascii::is_upper (t.character)) == t.is_upper;
|
bool is_upper = TRY_BOOL(cruft::ascii::is_upper (t.character)) == t.is_upper;
|
||||||
bool is_lower = TRY_BOOL(cruft::ascii::is_lower (t.character)) == t.is_lower;
|
bool is_lower = TRY_BOOL(cruft::ascii::is_lower (t.character)) == t.is_lower;
|
||||||
bool is_space = TRY_BOOL(cruft::ascii::is_space (t.character)) == t.is_space;
|
bool is_space = TRY_BOOL(cruft::ascii::is_space (t.character)) == t.is_space;
|
||||||
|
|
||||||
bool integer = !t.is_digit || cruft::ascii::to_integer (t.character) == t.integer;
|
bool integer = !t.is_digit || cruft::ascii::to_integer (t.character) == t.integer;
|
||||||
bool hexadecimal = !t.is_hex || cruft::ascii::from_hex (t.character) == t.hexadecimal;
|
bool hexadecimal = !t.is_hex || cruft::ascii::from_hex (t.character) == t.hexadecimal;
|
||||||
|
|
||||||
tap.expect (
|
tap.expect (
|
||||||
is_digit && is_hex && is_upper && is_lower && is_space && integer && hexadecimal,
|
is_digit && is_hex && is_upper && is_lower && is_space && integer && hexadecimal,
|
||||||
"%s", t.msg
|
"%s", t.msg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
tap.expect_eq ("6a"_hex2u8, std::vector<uint8_t>({0x6a}), "hex2u8, 1 byte");
|
tap.expect_eq ("6a"_hex2u8, std::vector<uint8_t>({0x6a}), "hex2u8, 1 byte");
|
||||||
tap.expect_eq ("a6"_hex2array, std::array<uint8_t,1> ({0xa6}), "hex2array, 1 byte");
|
tap.expect_eq ("a6"_hex2array, std::array<uint8_t,1> ({0xa6}), "hex2array, 1 byte");
|
||||||
|
});
|
||||||
return tap.status ();
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,10 @@ int
|
|||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
cruft::TAP::logger tap;
|
cruft::TAP::logger tap;
|
||||||
|
|
||||||
debug::backtrace ();
|
// Instantiate a backtrace just so we know that linking has worked.
|
||||||
|
debug::backtrace foo;
|
||||||
|
(void)foo;
|
||||||
|
|
||||||
tap.noop ();
|
tap.noop ();
|
||||||
|
|
||||||
return tap.status ();
|
return tap.status ();
|
||||||
|
@ -249,20 +249,18 @@ test_positional (cruft::TAP::logger &tap)
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
int
|
int
|
||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
cruft::TAP::logger tap;
|
return cruft::TAP::logger::run ([] (auto &tap) {
|
||||||
|
test_null (tap);
|
||||||
test_null (tap);
|
test_present (tap);
|
||||||
test_present (tap);
|
test_bool (tap);
|
||||||
test_bool (tap);
|
test_numeric< int16_t> (tap);
|
||||||
test_numeric< int16_t> (tap);
|
test_numeric< int32_t> (tap);
|
||||||
test_numeric< int32_t> (tap);
|
test_numeric< int64_t> (tap);
|
||||||
test_numeric< int64_t> (tap);
|
test_numeric<uint16_t> (tap);
|
||||||
test_numeric<uint16_t> (tap);
|
test_numeric<uint32_t> (tap);
|
||||||
test_numeric<uint32_t> (tap);
|
test_numeric<uint64_t> (tap);
|
||||||
test_numeric<uint64_t> (tap);
|
test_bytes (tap);
|
||||||
test_bytes (tap);
|
test_required (tap);
|
||||||
test_required (tap);
|
test_positional (tap);
|
||||||
test_positional (tap);
|
});
|
||||||
|
|
||||||
return tap.status ();
|
|
||||||
}
|
}
|
||||||
|
@ -30,20 +30,18 @@ struct {
|
|||||||
int
|
int
|
||||||
main (int, char**)
|
main (int, char**)
|
||||||
{
|
{
|
||||||
cruft::TAP::logger tap;
|
return cruft::TAP::logger::run ([] (auto &tap) {
|
||||||
|
for (const auto &t: TESTS) {
|
||||||
|
#define TEST(KLASS) do { \
|
||||||
|
auto computed = cruft::hash::KLASS{}(cruft::view {t.dat}.template cast<const uint8_t*> ()); \
|
||||||
|
tap.expect_eq (t.result.KLASS, computed, "%s: %s", #KLASS, t.msg); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
for (const auto &t: TESTS) {
|
TEST(crc32);
|
||||||
#define TEST(KLASS) do { \
|
TEST(crc32b);
|
||||||
auto computed = cruft::hash::KLASS{}(cruft::view {t.dat}.template cast<const uint8_t*> ()); \
|
TEST(crc32c);
|
||||||
tap.expect_eq (t.result.KLASS, computed, "%s: %s", #KLASS, t.msg); \
|
TEST(crc32d);
|
||||||
} while (0)
|
TEST(crc64);
|
||||||
|
}
|
||||||
TEST(crc32);
|
});
|
||||||
TEST(crc32b);
|
|
||||||
TEST(crc32c);
|
|
||||||
TEST(crc32d);
|
|
||||||
TEST(crc64);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tap.status ();
|
|
||||||
}
|
}
|
@ -124,12 +124,10 @@ done:
|
|||||||
int
|
int
|
||||||
main (int, char **)
|
main (int, char **)
|
||||||
{
|
{
|
||||||
cruft::TAP::logger tap;
|
return cruft::TAP::logger::run ([] (auto &tap) {
|
||||||
|
check_single (tap);
|
||||||
check_single (tap);
|
check_unique_ptr (tap);
|
||||||
check_unique_ptr (tap);
|
check_keep_value (tap);
|
||||||
check_keep_value (tap);
|
check_keep_variadic_value (tap);
|
||||||
check_keep_variadic_value (tap);
|
});
|
||||||
|
|
||||||
return tap.status ();
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "signal.hpp"
|
#include "signal.hpp"
|
||||||
|
|
||||||
|
#include "except.hpp"
|
||||||
#include "tap.hpp"
|
#include "tap.hpp"
|
||||||
|
|
||||||
|
|
||||||
@ -124,14 +125,12 @@ test_disconnect (cruft::TAP::logger &tap)
|
|||||||
int
|
int
|
||||||
main (int, char **)
|
main (int, char **)
|
||||||
{
|
{
|
||||||
cruft::TAP::logger tap;
|
return cruft::TAP::logger::run ([] (auto &tap) {
|
||||||
|
test_null (tap);
|
||||||
test_null (tap);
|
test_single (tap);
|
||||||
test_single (tap);
|
test_double (tap);
|
||||||
test_double (tap);
|
test_value_signal (tap);
|
||||||
test_value_signal (tap);
|
test_combiner (tap);
|
||||||
test_combiner (tap);
|
test_disconnect (tap);
|
||||||
test_disconnect (tap);
|
});
|
||||||
|
|
||||||
return tap.status ();
|
|
||||||
}
|
}
|
||||||
|
21
vector.cpp
21
vector.cpp
@ -9,6 +9,7 @@
|
|||||||
#include "vector.hpp"
|
#include "vector.hpp"
|
||||||
|
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
|
#include "std.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -91,24 +92,10 @@ struct cruft::debug::validator<vector<S,T>> {
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INSTANTIATE_S_T(S,T) \
|
#define INSTANTIATE_S_T(S,T) \
|
||||||
template struct cruft::vector<S,T>; \
|
template struct cruft::vector<(S),T>; \
|
||||||
template struct cruft::debug::validator<vector<S,T>>;
|
template struct cruft::debug::validator<vector<(S),T>>;
|
||||||
|
|
||||||
|
|
||||||
#define INSTANTIATE(T) \
|
|
||||||
INSTANTIATE_S_T(1,T) \
|
|
||||||
INSTANTIATE_S_T(2,T) \
|
|
||||||
INSTANTIATE_S_T(3,T) \
|
|
||||||
INSTANTIATE_S_T(4,T)
|
|
||||||
|
|
||||||
|
|
||||||
INSTANTIATE(uint32_t)
|
|
||||||
INSTANTIATE(int32_t)
|
|
||||||
INSTANTIATE(uint64_t)
|
|
||||||
INSTANTIATE(int64_t)
|
|
||||||
INSTANTIATE(float)
|
|
||||||
INSTANTIATE(double)
|
|
||||||
|
|
||||||
|
MAP_CRUFT_COORD_PARAMS(INSTANTIATE_S_T)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template vector<2,float> cruft::polar_to_cartesian (cruft::vector<2,float>);
|
template vector<2,float> cruft::polar_to_cartesian (cruft::vector<2,float>);
|
||||||
|
Loading…
Reference in New Issue
Block a user