Ad
  • Custom User Avatar

    OK, good to know!

  • Custom User Avatar

    Igloo uses showhouse::Stringizer to display actual and expected values.
    If there is a specialization of showhouse::Stringizer (in this case for std::tuple) igloo will automatically use it.
    You don't need to modify the tests.

    Cheers!

  • Custom User Avatar

    OK, lots of thanks! I will try. How do I use it in the tests?

  • Custom User Avatar

    You're talking about the C++ version, right?

    @g964
    You can use the full power of igloo / snowhouse by putting the following in the "Preloaded" section:

    #include <sstream>
    #include <tuple>
    
    namespace snowhouse {
        template<class Tuple, std::size_t N>
        struct TuplePrinter {
            static void print(std::ostream& out, const Tuple& t) {
                TuplePrinter<Tuple, N - 1>::print(out, t);
                out << ", " << Stringizer<decltype(std::get<N-1>(t))>::ToString(std::get<N-1>(t));
            }
        };
        template<class Tuple>
        struct TuplePrinter<Tuple, 1> {
            static void print(std::ostream& out, const Tuple& t) {
                out << Stringizer<decltype(std::get<0>(t))>::ToString(std::get<0>(t));
            }
        };
        template<typename... Args>
        struct Stringizer<std::tuple<Args...>> {
            static std::string ToString(const std::tuple<Args...>& tuple) {
                std::ostringstream out;
                out << "(";
                if (sizeof...(Args))
                    TuplePrinter<decltype(tuple), sizeof...(Args)>::print(out, tuple);
                out << ")";
                return out.str();
            }
        };
    }
    

    Then

    Expected: equal to [ [unsupported type], [unsupported type] ]
    Actual: [ [unsupported type], [unsupported type] ]
    

    becomes

    Expected: equal to [ (2, 4, 2000), (4, 0, 103) ]
    Actual: [ (6, 1, 123), (16, 2, 4444) ]
    
  • Custom User Avatar

    It happens when there is a flaw in your code.