Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test domain_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::logic_error, std::domain_error>::value),
|
||||
"std::is_base_of<std::logic_error, std::domain_error>::value");
|
||||
static_assert(std::is_polymorphic<std::domain_error>::value,
|
||||
"std::is_polymorphic<std::domain_error>::value");
|
||||
{
|
||||
const char* msg = "domain_error message";
|
||||
std::domain_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::domain_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another domain_error message");
|
||||
std::domain_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::domain_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test invalid_argument
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::logic_error, std::invalid_argument>::value),
|
||||
"std::is_base_of<std::logic_error, std::invalid_argument>::value");
|
||||
static_assert(std::is_polymorphic<std::invalid_argument>::value,
|
||||
"std::is_polymorphic<std::invalid_argument>::value");
|
||||
{
|
||||
const char* msg = "invalid_argument message";
|
||||
std::invalid_argument e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::invalid_argument e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another invalid_argument message");
|
||||
std::invalid_argument e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::invalid_argument e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test length_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::logic_error, std::length_error>::value),
|
||||
"std::is_base_of<std::logic_error, std::length_error>::value");
|
||||
static_assert(std::is_polymorphic<std::length_error>::value,
|
||||
"std::is_polymorphic<std::length_error>::value");
|
||||
{
|
||||
const char* msg = "length_error message";
|
||||
std::length_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::length_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another length_error message");
|
||||
std::length_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::length_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test logic_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::exception, std::logic_error>::value),
|
||||
"std::is_base_of<std::exception, std::logic_error>::value");
|
||||
static_assert(std::is_polymorphic<std::logic_error>::value,
|
||||
"std::is_polymorphic<std::logic_error>::value");
|
||||
{
|
||||
const char* msg = "logic_error message";
|
||||
std::logic_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::logic_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another logic_error message");
|
||||
std::logic_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::logic_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test out_of_range
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::logic_error, std::out_of_range>::value),
|
||||
"std::is_base_of<std::logic_error, std::out_of_range>::value");
|
||||
static_assert(std::is_polymorphic<std::out_of_range>::value,
|
||||
"std::is_polymorphic<std::out_of_range>::value");
|
||||
{
|
||||
const char* msg = "out_of_range message";
|
||||
std::out_of_range e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::out_of_range e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another out_of_range message");
|
||||
std::out_of_range e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::out_of_range e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test overflow_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::runtime_error, std::overflow_error>::value),
|
||||
"std::is_base_of<std::runtime_error, std::overflow_error>::value");
|
||||
static_assert(std::is_polymorphic<std::overflow_error>::value,
|
||||
"std::is_polymorphic<std::overflow_error>::value");
|
||||
{
|
||||
const char* msg = "overflow_error message";
|
||||
std::overflow_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::overflow_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another overflow_error message");
|
||||
std::overflow_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::overflow_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test range_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::runtime_error, std::range_error>::value),
|
||||
"std::is_base_of<std::runtime_error, std::range_error>::value");
|
||||
static_assert(std::is_polymorphic<std::range_error>::value,
|
||||
"std::is_polymorphic<std::range_error>::value");
|
||||
{
|
||||
const char* msg = "range_error message";
|
||||
std::range_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::range_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another range_error message");
|
||||
std::range_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::range_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test runtime_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::exception, std::runtime_error>::value),
|
||||
"std::is_base_of<std::exception, std::runtime_error>::value");
|
||||
static_assert(std::is_polymorphic<std::runtime_error>::value,
|
||||
"std::is_polymorphic<std::runtime_error>::value");
|
||||
{
|
||||
const char* msg = "runtime_error message";
|
||||
std::runtime_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::runtime_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another runtime_error message");
|
||||
std::runtime_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::runtime_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// test underflow_error
|
||||
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
static_assert((std::is_base_of<std::runtime_error, std::underflow_error>::value),
|
||||
"std::is_base_of<std::runtime_error, std::underflow_error>::value");
|
||||
static_assert(std::is_polymorphic<std::underflow_error>::value,
|
||||
"std::is_polymorphic<std::underflow_error>::value");
|
||||
{
|
||||
const char* msg = "underflow_error message";
|
||||
std::underflow_error e(msg);
|
||||
assert(std::strcmp(e.what(), msg) == 0);
|
||||
std::underflow_error e2(e);
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
e2 = e;
|
||||
assert(std::strcmp(e2.what(), msg) == 0);
|
||||
}
|
||||
{
|
||||
std::string msg("another underflow_error message");
|
||||
std::underflow_error e(msg);
|
||||
assert(e.what() == msg);
|
||||
std::underflow_error e2(e);
|
||||
assert(e2.what() == msg);
|
||||
e2 = e;
|
||||
assert(e2.what() == msg);
|
||||
}
|
||||
}
|
20
test/std/diagnostics/std.exceptions/version.pass.cpp
Normal file
20
test/std/diagnostics/std.exceptions/version.pass.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <stdexcept>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#ifndef _LIBCPP_VERSION
|
||||
#error _LIBCPP_VERSION not defined
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user