diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 19:42:16 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-05-11 19:42:16 +0000 |
commit | 3e519524c118651123eecf60c2bbc5d65ad9bac3 (patch) | |
tree | b2dd4168cfe448920a602cd7d2e40f95da187153 /libcxx/test/language.support/support.runtime | |
parent | 9132c59d43b6c590c9bb33496eebf9f192d6857a (diff) | |
download | bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.tar.gz bcm5719-llvm-3e519524c118651123eecf60c2bbc5d65ad9bac3.zip |
libcxx initial import
llvm-svn: 103490
Diffstat (limited to 'libcxx/test/language.support/support.runtime')
12 files changed, 392 insertions, 0 deletions
diff --git a/libcxx/test/language.support/support.runtime/csetjmp.pass.cpp b/libcxx/test/language.support/support.runtime/csetjmp.pass.cpp new file mode 100644 index 00000000000..c57bab986a3 --- /dev/null +++ b/libcxx/test/language.support/support.runtime/csetjmp.pass.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test <csetjmp> + +#include <csetjmp> +#include <type_traits> + +#ifndef setjmp +#error setjmp not defined +#endif + +int main() +{ + std::jmp_buf jb; + static_assert((std::is_same<__typeof__(std::longjmp(jb, 0)), void>::value), + "std::is_same<__typeof__(std::longjmp(jb, 0)), void>::value"); +} diff --git a/libcxx/test/language.support/support.runtime/csignal.pass.cpp b/libcxx/test/language.support/support.runtime/csignal.pass.cpp new file mode 100644 index 00000000000..0dcabb0e53e --- /dev/null +++ b/libcxx/test/language.support/support.runtime/csignal.pass.cpp @@ -0,0 +1,57 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test <csignal> + +#include <csignal> +#include <type_traits> + +#ifndef SIG_DFL +#error SIG_DFL not defined +#endif + +#ifndef SIG_ERR +#error SIG_ERR not defined +#endif + +#ifndef SIG_IGN +#error SIG_IGN not defined +#endif + +#ifndef SIGABRT +#error SIGABRT not defined +#endif + +#ifndef SIGFPE +#error SIGFPE not defined +#endif + +#ifndef SIGILL +#error SIGILL not defined +#endif + +#ifndef SIGINT +#error SIGINT not defined +#endif + +#ifndef SIGSEGV +#error SIGSEGV not defined +#endif + +#ifndef SIGTERM +#error SIGTERM not defined +#endif + +int main() +{ + std::sig_atomic_t sig; + typedef void (*func)(int); + static_assert((std::is_same<decltype(std::signal(0, (func)0)), func>::value), ""); + static_assert((std::is_same<decltype(std::raise(0)), int>::value), ""); +} diff --git a/libcxx/test/language.support/support.runtime/cstdarg.pass.cpp b/libcxx/test/language.support/support.runtime/cstdarg.pass.cpp new file mode 100644 index 00000000000..f25bdb6a82d --- /dev/null +++ b/libcxx/test/language.support/support.runtime/cstdarg.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test <cstdarg> + +#include <cstdarg> + +#ifndef va_arg +#error va_arg not defined +#endif + +#ifndef va_copy +#error va_copy not defined +#endif + +#ifndef va_end +#error va_end not defined +#endif + +#ifndef va_start +#error va_start not defined +#endif + +int main() +{ + std::va_list va; +} diff --git a/libcxx/test/language.support/support.runtime/cstdbool.pass.cpp b/libcxx/test/language.support/support.runtime/cstdbool.pass.cpp new file mode 100644 index 00000000000..7d4dcd25a71 --- /dev/null +++ b/libcxx/test/language.support/support.runtime/cstdbool.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test <cstdbool> + +#include <cstdbool> + +#ifndef __bool_true_false_are_defined +#error __bool_true_false_are_defined not defined +#endif + +#ifdef bool +#error bool should not be defined +#endif + +#ifdef true +#error true should not be defined +#endif + +#ifdef false +#error false should not be defined +#endif + +int main() +{ +} diff --git a/libcxx/test/language.support/support.runtime/cstdlib.pass.cpp b/libcxx/test/language.support/support.runtime/cstdlib.pass.cpp new file mode 100644 index 00000000000..3e42f8c8fc9 --- /dev/null +++ b/libcxx/test/language.support/support.runtime/cstdlib.pass.cpp @@ -0,0 +1,86 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test <cstdlib> + +#include <cstdlib> +#include <type_traits> + +#ifndef EXIT_FAILURE +#error EXIT_FAILURE not defined +#endif + +#ifndef EXIT_SUCCESS +#error EXIT_SUCCESS not defined +#endif + +#ifndef MB_CUR_MAX +#error MB_CUR_MAX not defined +#endif + +#ifndef NULL +#error NULL not defined +#endif + +#ifndef RAND_MAX +#error RAND_MAX not defined +#endif + +int main() +{ + std::size_t s = 0; + std::div_t d; + std::ldiv_t ld; + std::lldiv_t lld; + char** endptr = 0; + static_assert((std::is_same<decltype(std::atof("")), double>::value), ""); + static_assert((std::is_same<decltype(std::atoi("")), int>::value), ""); + static_assert((std::is_same<decltype(std::atol("")), long>::value), ""); + static_assert((std::is_same<decltype(std::atoll("")), long long>::value), ""); + static_assert((std::is_same<decltype(std::getenv("")), char*>::value), ""); + static_assert((std::is_same<decltype(std::strtod("", endptr)), double>::value), ""); + static_assert((std::is_same<decltype(std::strtof("", endptr)), float>::value), ""); + static_assert((std::is_same<decltype(std::strtold("", endptr)), long double>::value), ""); + static_assert((std::is_same<decltype(std::strtol("", endptr,0)), long>::value), ""); + static_assert((std::is_same<decltype(std::strtoll("", endptr,0)), long long>::value), ""); + static_assert((std::is_same<decltype(std::strtoul("", endptr,0)), unsigned long>::value), ""); + static_assert((std::is_same<decltype(std::strtoull("", endptr,0)), unsigned long long>::value), ""); + static_assert((std::is_same<decltype(std::rand()), int>::value), ""); + static_assert((std::is_same<decltype(std::srand(0)), void>::value), ""); + static_assert((std::is_same<decltype(std::calloc(0,0)), void*>::value), ""); + static_assert((std::is_same<decltype(std::free(0)), void>::value), ""); + static_assert((std::is_same<decltype(std::malloc(0)), void*>::value), ""); + static_assert((std::is_same<decltype(std::realloc(0,0)), void*>::value), ""); + static_assert((std::is_same<decltype(std::abort()), void>::value), ""); + static_assert((std::is_same<decltype(std::atexit(0)), int>::value), ""); + static_assert((std::is_same<decltype(std::exit(0)), void>::value), ""); + static_assert((std::is_same<decltype(std::_Exit(0)), void>::value), ""); + static_assert((std::is_same<decltype(std::getenv("")), char*>::value), ""); + static_assert((std::is_same<decltype(std::system("")), int>::value), ""); + static_assert((std::is_same<decltype(std::bsearch(0,0,0,0,0)), void*>::value), ""); + static_assert((std::is_same<decltype(std::qsort(0,0,0,0)), void>::value), ""); + static_assert((std::is_same<decltype(std::abs(0)), int>::value), ""); + static_assert((std::is_same<decltype(std::abs((long)0)), long>::value), ""); + static_assert((std::is_same<decltype(std::abs((long long)0)), long long>::value), ""); + static_assert((std::is_same<decltype(std::labs((long)0)), long>::value), ""); + static_assert((std::is_same<decltype(std::llabs((long long)0)), long long>::value), ""); + static_assert((std::is_same<decltype(std::div(0,0)), std::div_t>::value), ""); + static_assert((std::is_same<decltype(std::div(0L,0L)), std::ldiv_t>::value), ""); + static_assert((std::is_same<decltype(std::div(0LL,0LL)), std::lldiv_t>::value), ""); + static_assert((std::is_same<decltype(std::ldiv(0L,0L)), std::ldiv_t>::value), ""); + static_assert((std::is_same<decltype(std::lldiv(0LL,0LL)), std::lldiv_t>::value), ""); + static_assert((std::is_same<decltype(std::mblen("",0)), int>::value), ""); + wchar_t* pw = 0; + const wchar_t* pwc = 0; + char* pc = 0; + static_assert((std::is_same<decltype(std::mbtowc(pw,"",0)), int>::value), ""); + static_assert((std::is_same<decltype(std::wctomb(pc,L' ')), int>::value), ""); + static_assert((std::is_same<decltype(std::mbstowcs(pw,"",0)), std::size_t>::value), ""); + static_assert((std::is_same<decltype(std::wcstombs(pc,pwc,0)), std::size_t>::value), ""); +} diff --git a/libcxx/test/language.support/support.runtime/ctime.pass.cpp b/libcxx/test/language.support/support.runtime/ctime.pass.cpp new file mode 100644 index 00000000000..4b205762ecc --- /dev/null +++ b/libcxx/test/language.support/support.runtime/ctime.pass.cpp @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// test <ctime> + +#include <ctime> +#include <type_traits> + +#ifndef NULL +#error NULL not defined +#endif + +#ifndef CLOCKS_PER_SEC +#error CLOCKS_PER_SEC not defined +#endif + +int main() +{ + std::clock_t c = 0; + std::size_t s = 0; + std::time_t t = 0; + std::tm tm = {0}; + static_assert((std::is_same<decltype(std::clock()), std::clock_t>::value), ""); + static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), ""); + static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), ""); + static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), ""); + static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), ""); + static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), ""); + static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), ""); + static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), ""); + char* c1 = 0; + const char* c2 = 0; + static_assert((std::is_same<decltype(std::strftime(c1,s,c2,&tm)), std::size_t>::value), ""); +} diff --git a/libcxx/test/language.support/support.runtime/version_csetjmp.pass.cpp b/libcxx/test/language.support/support.runtime/version_csetjmp.pass.cpp new file mode 100644 index 00000000000..6607f7d5bac --- /dev/null +++ b/libcxx/test/language.support/support.runtime/version_csetjmp.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <csetjmp> + +#include <csetjmp> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/libcxx/test/language.support/support.runtime/version_csignal.pass.cpp b/libcxx/test/language.support/support.runtime/version_csignal.pass.cpp new file mode 100644 index 00000000000..5d4a38eb9bd --- /dev/null +++ b/libcxx/test/language.support/support.runtime/version_csignal.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <csignal> + +#include <csignal> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/libcxx/test/language.support/support.runtime/version_cstdarg.pass.cpp b/libcxx/test/language.support/support.runtime/version_cstdarg.pass.cpp new file mode 100644 index 00000000000..16e2e9e099e --- /dev/null +++ b/libcxx/test/language.support/support.runtime/version_cstdarg.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <cstdarg> + +#include <cstdarg> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/libcxx/test/language.support/support.runtime/version_cstdbool.pass.cpp b/libcxx/test/language.support/support.runtime/version_cstdbool.pass.cpp new file mode 100644 index 00000000000..2eab23b4436 --- /dev/null +++ b/libcxx/test/language.support/support.runtime/version_cstdbool.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <cstdbool> + +#include <cstdbool> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/libcxx/test/language.support/support.runtime/version_cstdlib.pass.cpp b/libcxx/test/language.support/support.runtime/version_cstdlib.pass.cpp new file mode 100644 index 00000000000..7de716942fc --- /dev/null +++ b/libcxx/test/language.support/support.runtime/version_cstdlib.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <cstdlib> + +#include <cstdlib> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} diff --git a/libcxx/test/language.support/support.runtime/version_ctime.pass.cpp b/libcxx/test/language.support/support.runtime/version_ctime.pass.cpp new file mode 100644 index 00000000000..659d85e8be3 --- /dev/null +++ b/libcxx/test/language.support/support.runtime/version_ctime.pass.cpp @@ -0,0 +1,20 @@ +//===----------------------------------------------------------------------===// +// +// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <ctime> + +#include <ctime> + +#ifndef _LIBCPP_VERSION +#error _LIBCPP_VERSION not defined +#endif + +int main() +{ +} |