lest icon indicating copy to clipboard operation
lest copied to clipboard

lest 2 - learn from stf by Joel Falcou

Open martinmoene opened this issue 10 years ago • 5 comments

Study stf by @jfalcou and let lest benefit from it.

Ideas:

  • [ ] Use auto test case registration only.
  • [ ] Use default suite, but still allow for user to specify one, e.g. for testing lest itself.
  • [ ] Add ULP comparison
  • [ ] Add PASS/FAIL/TYPE_IS/EXPR_IS/EXPR_TYPE
  • [ ] Add typed tests (see what can be done w/o Boost).
  • [ ] Fail empty test cases
  • [ ] Simplify reporting mechanism
  • [ ] Use C++ Detection Idiom (N4436), see below
  • [ ] ...

Not supporting VC12 (VS2013), the detection mechanism can be simplified to:

#include <type_traits>

// Use pre-C++17 workaround for void_t:
// using std::void_t;   // template< typename... > using void_t = void;
template<typename... Ts> struct make_void { typedef void type;};
template<typename... Ts> using void_t = typename make_void<Ts...>::type;

template< typename, typename = void_t<> >
struct has_begin : std::false_type{};

template< typename T >
struct has_begin<T, void_t<decltype(std::declval<T>().begin())>> : std::true_type{};

template <typename, typename = void_t<> >
struct has_end : std::false_type{};

template <typename T>
struct has_end<T, void_t<decltype(std::declval<T>().end())>> : std::true_type{};

template <typename T>
using is_sequence = std::integral_constant<bool, has_end<T>::value && has_begin<T>::value>;

martinmoene avatar Jan 14 '16 11:01 martinmoene

would you be interested by some PR for those ?

jfalcou avatar Apr 30 '18 19:04 jfalcou

A kind offer, in which I'm certainly interested (although I might not be entirely ready for it).

I Just created branch lest-v2 for it.

martinmoene avatar Apr 30 '18 20:04 martinmoene

Good. What is the minimal language version 11 or 14 ? C++14 makes a lot of things easier with polymorphic lambda and auto without trailing decltype.

jfalcou avatar May 01 '18 17:05 jfalcou

I like to keep it at C++11.

martinmoene avatar May 01 '18 22:05 martinmoene

OK. I've forked the repo & will do some testing soon on how to adapt my old code to LEST.

jfalcou avatar May 02 '18 08:05 jfalcou