예제 #1
0
int main()
{
	int Error = 0;

	Error += test_member_alloc_bug();
	Error += test_ctr();

	Error += test_operators<glm::mat4, glm::vec4>();
	Error += test_operators<glm::lowp_mat4, glm::lowp_vec4>();
	Error += test_operators<glm::mediump_mat4, glm::mediump_vec4>();
	Error += test_operators<glm::highp_mat4, glm::highp_vec4>();

	Error += test_operators<glm::dmat4, glm::dvec4>();
	Error += test_operators<glm::lowp_dmat4, glm::lowp_dvec4>();
	Error += test_operators<glm::mediump_dmat4, glm::mediump_dvec4>();
	Error += test_operators<glm::highp_dmat4, glm::highp_dvec4>();

	Error += test_inverse<glm::mat4>();
	Error += test_inverse<glm::lowp_mat4>();
	Error += test_inverse<glm::mediump_mat4>();
	Error += test_inverse<glm::highp_mat4>();

	Error += test_inverse<glm::dmat4>();
	Error += test_inverse<glm::lowp_dmat4>();
	Error += test_inverse<glm::mediump_dmat4>();
	Error += test_inverse<glm::highp_dmat4>();

	Error += test_size();
	Error += test_constexpr();

	return Error;
}
예제 #2
0
int main()
{
    int ia[] = {0, 1, 2, 3, 0, 1, 2, 3};
    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
    int ib[] = {1, 3, 5, 7};
    const unsigned sb = sizeof(ib)/sizeof(ib[0]);
    assert(std::find_first_of(input_iterator<const int*>(ia),
                              input_iterator<const int*>(ia + sa),
                              forward_iterator<const int*>(ib),
                              forward_iterator<const int*>(ib + sb)) ==
                              input_iterator<const int*>(ia+1));
    int ic[] = {7};
    assert(std::find_first_of(input_iterator<const int*>(ia),
                              input_iterator<const int*>(ia + sa),
                              forward_iterator<const int*>(ic),
                              forward_iterator<const int*>(ic + 1)) ==
                              input_iterator<const int*>(ia+sa));
    assert(std::find_first_of(input_iterator<const int*>(ia),
                              input_iterator<const int*>(ia + sa),
                              forward_iterator<const int*>(ic),
                              forward_iterator<const int*>(ic)) ==
                              input_iterator<const int*>(ia+sa));
    assert(std::find_first_of(input_iterator<const int*>(ia),
                              input_iterator<const int*>(ia),
                              forward_iterator<const int*>(ic),
                              forward_iterator<const int*>(ic+1)) ==
                              input_iterator<const int*>(ia));

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif
}
예제 #3
0
int main(int, char**)
{
    using year           = std::chrono::year;
    using month          = std::chrono::month;
    using day            = std::chrono::day;
    using year_month_day = std::chrono::year_month_day;
    using years          = std::chrono::years;

    ASSERT_NOEXCEPT(                          std::declval<year_month_day>() - std::declval<years>());
    ASSERT_SAME_TYPE(year_month_day, decltype(std::declval<year_month_day>() - std::declval<years>()));

    constexpr month January = std::chrono::January;

    static_assert(test_constexpr(), "");

    year_month_day ym{year{1234}, January, day{10}};
    for (int i = 0; i <= 10; ++i)
    {
        year_month_day ym1 = ym - years{i};
        assert(static_cast<int>(ym1.year()) == 1234 - i);
        assert(ym1.month() == January);
        assert(ym1.day() == day{10});
    }

  return 0;
}
예제 #4
0
int main(int, char**)
{
    assert(std::char_traits<char8_t>::compare(u8"", u8"", 0) == 0);
    assert(std::char_traits<char8_t>::compare(NULL, NULL, 0) == 0);

    assert(std::char_traits<char8_t>::compare(u8"1", u8"1", 1) == 0);
    assert(std::char_traits<char8_t>::compare(u8"1", u8"2", 1) < 0);
    assert(std::char_traits<char8_t>::compare(u8"2", u8"1", 1) > 0);

    assert(std::char_traits<char8_t>::compare(u8"12", u8"12", 2) == 0);
    assert(std::char_traits<char8_t>::compare(u8"12", u8"13", 2) < 0);
    assert(std::char_traits<char8_t>::compare(u8"12", u8"22", 2) < 0);
    assert(std::char_traits<char8_t>::compare(u8"13", u8"12", 2) > 0);
    assert(std::char_traits<char8_t>::compare(u8"22", u8"12", 2) > 0);

    assert(std::char_traits<char8_t>::compare(u8"123", u8"123", 3) == 0);
    assert(std::char_traits<char8_t>::compare(u8"123", u8"223", 3) < 0);
    assert(std::char_traits<char8_t>::compare(u8"123", u8"133", 3) < 0);
    assert(std::char_traits<char8_t>::compare(u8"123", u8"124", 3) < 0);
    assert(std::char_traits<char8_t>::compare(u8"223", u8"123", 3) > 0);
    assert(std::char_traits<char8_t>::compare(u8"133", u8"123", 3) > 0);
    assert(std::char_traits<char8_t>::compare(u8"124", u8"123", 3) > 0);

    static_assert(test_constexpr(), "" );
    return 0;
}
예제 #5
0
int main()
{
    test();

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif
}
예제 #6
0
int main()
{
    test<forward_iterator<const int*> >();
    test<bidirectional_iterator<const int*> >();
    test<random_access_iterator<const int*> >();

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif
}
예제 #7
0
void testmain(void) {
    print("sizeof");
    test_primitives();
    test_pointers();
    test_unsigned();
    test_literals();
    test_arrays();
    test_vars();
    test_struct();
    test_constexpr();
}
예제 #8
0
int main(int, char**)
{
    char8_t s1[] = {1, 2, 3};
    assert(std::char_traits<char8_t>::find(s1, 3, char8_t(1)) == s1);
    assert(std::char_traits<char8_t>::find(s1, 3, char8_t(2)) == s1+1);
    assert(std::char_traits<char8_t>::find(s1, 3, char8_t(3)) == s1+2);
    assert(std::char_traits<char8_t>::find(s1, 3, char8_t(4)) == 0);
    assert(std::char_traits<char8_t>::find(s1, 3, char8_t(0)) == 0);
    assert(std::char_traits<char8_t>::find(NULL, 0, char8_t(0)) == 0);

    static_assert(test_constexpr(), "" );
}
예제 #9
0
int main(int, char**)
{
    wchar_t c = L'\0';
    std::char_traits<wchar_t>::assign(c, L'a');
    assert(c == L'a');

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "" );
#endif

  return 0;
}
예제 #10
0
int main()
{
	int Error = 0;

	Error += test_ctr();
	Error += test_two_axis_ctr();
	Error += test_size();
	Error += test_precision();
	Error += test_constexpr();

	return Error;
}
예제 #11
0
파일: ext_vec1.cpp 프로젝트: YOU-i-Labs/glm
int main()
{
	int Error = 0;

	Error += test_vec1_size();
	Error += test_vec1_ctor();
	Error += test_bvec1_ctor();
	Error += test_vec1_operators();
	Error += test_vec1_operator_increment();
	Error += test_constexpr();
	
	return Error;
}
예제 #12
0
void test_sequence1 () {
    std::vector<int> v;
    for ( int i = 5; i < 15; ++i )
        v.push_back ( i );
    test_sequence  ( v );
    
    BOOST_CXX14_CONSTEXPR bool constexpr_res = test_constexpr();
    BOOST_CHECK(constexpr_res);
    
    std::list<int> l;
    for ( int i = 25; i > 15; --i )
        l.push_back ( i );
    test_sequence  ( l );   
    }
예제 #13
0
int main()
{
    {
    std::chrono::seconds s(3);
    s -= std::chrono::seconds(2);
    assert(s.count() == 1);
    s -= std::chrono::minutes(2);
    assert(s.count() == -119);
    }

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "");
#endif
}
예제 #14
0
int main(int, char**)
{
    {
    std::chrono::hours h(3);
    std::chrono::hours& href = --h;
    assert(&href == &h);
    assert(h.count() == 2);
    }

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "");
#endif

  return 0;
}
예제 #15
0
int main()
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
    assert(std::char_traits<char16_t>::length(u"") == 0);
    assert(std::char_traits<char16_t>::length(u"a") == 1);
    assert(std::char_traits<char16_t>::length(u"aa") == 2);
    assert(std::char_traits<char16_t>::length(u"aaa") == 3);
    assert(std::char_traits<char16_t>::length(u"aaaa") == 4);
#endif

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "" );
#endif
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
}
예제 #16
0
int main(int, char**)
{
    wchar_t s1[] = {1, 2, 3};
    assert(std::char_traits<wchar_t>::find(s1, 3, wchar_t(1)) == s1);
    assert(std::char_traits<wchar_t>::find(s1, 3, wchar_t(2)) == s1+1);
    assert(std::char_traits<wchar_t>::find(s1, 3, wchar_t(3)) == s1+2);
    assert(std::char_traits<wchar_t>::find(s1, 3, wchar_t(4)) == 0);
    assert(std::char_traits<wchar_t>::find(s1, 3, wchar_t(0)) == 0);
    assert(std::char_traits<wchar_t>::find(NULL, 0, wchar_t(0)) == 0);

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "" );
#endif

  return 0;
}
예제 #17
0
int main(int, char**)
{
    int ia[] = {0, 1, 2, 3, 4, 5};
    const unsigned s = sizeof(ia)/sizeof(ia[0]);
    input_iterator<const int*> r = std::find(input_iterator<const int*>(ia),
                                             input_iterator<const int*>(ia+s), 3);
    assert(*r == 3);
    r = std::find(input_iterator<const int*>(ia), input_iterator<const int*>(ia+s), 10);
    assert(r == input_iterator<const int*>(ia+s));

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif

  return 0;
}
예제 #18
0
int main()
{
    int d[] = {3, 2, 1, 0};
    for (int* e = d; e <= d+4; ++e)
        for (int x = -1; x <= 4; ++x)
            test(d, e, x);

    test<forward_iterator<const int*> >();
    test<bidirectional_iterator<const int*> >();
    test<random_access_iterator<const int*> >();
    test<const int*>();

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif
}
예제 #19
0
int tc_libcxx_strings_char_traits_specializations_char32_t_length(void)
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
#if TEST_STD_VER >= 11
    TC_ASSERT_EXPR(std::char_traits<char32_t>::length(U"") == 0);
    TC_ASSERT_EXPR(std::char_traits<char32_t>::length(U"a") == 1);
    TC_ASSERT_EXPR(std::char_traits<char32_t>::length(U"aa") == 2);
    TC_ASSERT_EXPR(std::char_traits<char32_t>::length(U"aaa") == 3);
    TC_ASSERT_EXPR(std::char_traits<char32_t>::length(U"aaaa") == 4);
#endif

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "" );
#endif
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
    TC_SUCCESS_RESULT();
    return 0;
}
예제 #20
0
int tc_libcxx_strings_char_traits_specializations_char16_t_find(void)
{
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
    char16_t s1[] = {1, 2, 3};
    TC_ASSERT_EXPR(std::char_traits<char16_t>::find(s1, 3, char16_t(1)) == s1);
    TC_ASSERT_EXPR(std::char_traits<char16_t>::find(s1, 3, char16_t(2)) == s1+1);
    TC_ASSERT_EXPR(std::char_traits<char16_t>::find(s1, 3, char16_t(3)) == s1+2);
    TC_ASSERT_EXPR(std::char_traits<char16_t>::find(s1, 3, char16_t(4)) == 0);
    TC_ASSERT_EXPR(std::char_traits<char16_t>::find(s1, 3, char16_t(0)) == 0);
    TC_ASSERT_EXPR(std::char_traits<char16_t>::find(NULL, 0, char16_t(0)) == 0);

#if TEST_STD_VER > 14
    static_assert(test_constexpr(), "" );
#endif
#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
    TC_SUCCESS_RESULT();
    return 0;
}
예제 #21
0
int main(int, char**)
{
    int ia[] = {0, 1, 2, 2, 0, 1, 2, 3};
    const unsigned sa = sizeof(ia)/sizeof(ia[0]);
    assert(std::count_if(input_iterator<const int*>(ia),
                         input_iterator<const int*>(ia + sa),
                         eq(2)) == 3);
    assert(std::count_if(input_iterator<const int*>(ia),
                         input_iterator<const int*>(ia + sa),
                         eq(7)) == 0);
    assert(std::count_if(input_iterator<const int*>(ia),
                         input_iterator<const int*>(ia),
                         eq(2)) == 0);

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif

  return 0;
}
예제 #22
0
int main(int, char**)
{
    typedef input_iterator<int*> Iter;
    int ia[] = {0, 1, 2, 3, 4, 5};
    const unsigned s = sizeof(ia)/sizeof(ia[0]);

    {
    auto f = for_each_test(0);
    Iter it = std::for_each_n(Iter(ia), 0, std::ref(f));
    assert(it == Iter(ia));
    assert(f.count == 0);
    }

    {
    auto f = for_each_test(0);
    Iter it = std::for_each_n(Iter(ia), s, std::ref(f));

    assert(it == Iter(ia+s));
    assert(f.count == s);
    for (unsigned i = 0; i < s; ++i)
        assert(ia[i] == static_cast<int>(i+1));
    }

    {
    auto f = for_each_test(0);
    Iter it = std::for_each_n(Iter(ia), 1, std::ref(f));

    assert(it == Iter(ia+1));
    assert(f.count == 1);
    for (unsigned i = 0; i < 1; ++i)
        assert(ia[i] == static_cast<int>(i+2));
    }

#if TEST_STD_VER > 17
    static_assert(test_constexpr());
#endif

  return 0;
}
예제 #23
0
int main(int, char**)
{
    test<input_iterator<const int*>, input_iterator<const int*> >();
    test<input_iterator<const int*>, forward_iterator<const int*> >();
    test<input_iterator<const int*>, bidirectional_iterator<const int*> >();
    test<input_iterator<const int*>, random_access_iterator<const int*> >();
    test<input_iterator<const int*>, const int*>();

    test<forward_iterator<const int*>, input_iterator<const int*> >();
    test<forward_iterator<const int*>, forward_iterator<const int*> >();
    test<forward_iterator<const int*>, bidirectional_iterator<const int*> >();
    test<forward_iterator<const int*>, random_access_iterator<const int*> >();
    test<forward_iterator<const int*>, const int*>();

    test<bidirectional_iterator<const int*>, input_iterator<const int*> >();
    test<bidirectional_iterator<const int*>, forward_iterator<const int*> >();
    test<bidirectional_iterator<const int*>, bidirectional_iterator<const int*> >();
    test<bidirectional_iterator<const int*>, random_access_iterator<const int*> >();
    test<bidirectional_iterator<const int*>, const int*>();

    test<random_access_iterator<const int*>, input_iterator<const int*> >();
    test<random_access_iterator<const int*>, forward_iterator<const int*> >();
    test<random_access_iterator<const int*>, bidirectional_iterator<const int*> >();
    test<random_access_iterator<const int*>, random_access_iterator<const int*> >();
    test<random_access_iterator<const int*>, const int*>();

    test<const int*, input_iterator<const int*> >();
    test<const int*, forward_iterator<const int*> >();
    test<const int*, bidirectional_iterator<const int*> >();
    test<const int*, random_access_iterator<const int*> >();
    test<const int*, const int*>();

#if TEST_STD_VER > 17
   static_assert(test_constexpr());
#endif

  return 0;
}