Пример #1
0
void test1 ( std::experimental::basic_string_view<CharT> sv1,
             size_t pos1, size_t n1, const CharT *s, int expected ) {
    if (pos1 > sv1.size()) {
#ifndef TEST_HAS_NO_EXCEPTIONS
        try {
            sv1.compare(pos1, n1, s);
            assert(false);
        } catch (const std::out_of_range&) {
        } catch (...) {
            assert(false);
        }
#endif
    } else {
        assert(sign(sv1.compare(pos1, n1, s)) == sign(expected));
    }
}
Пример #2
0
void test1 ( std::experimental::basic_string_view<CharT> sv1, 
             size_t pos1, size_t n1, const CharT *s, int expected ) {
    try {
        assert(sign(sv1.compare(pos1, n1, s)) == sign(expected));
        assert(pos1 <= sv1.size());
    }
    catch (const std::out_of_range&) { assert(pos1 > sv1.size()); }
}
void test1 ( std::experimental::basic_string_view<CharT> sv1, const CharT *s, int expected ) {
    assert ( sign( sv1.compare(s)) == sign(expected));
}