diff options
Diffstat (limited to 'libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations')
7 files changed, 181 insertions, 0 deletions
diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp new file mode 100644 index 00000000000..a602e3e94be --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/addition.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// template <class StateT> class fpos + +// Addition + +#include <ios> +#include <cassert> + +int main() +{ + typedef std::fpos<std::mbstate_t> P; + P p(5); + std::streamoff o(6); + P q = p + o; + assert(q == P(11)); + p += o; + assert(p == q); +} diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp new file mode 100644 index 00000000000..1b939d86e59 --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/ctor_int.pass.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// template <class StateT> class fpos + +// fpos(int) + +#include <ios> +#include <cassert> + +int main() +{ + typedef std::fpos<std::mbstate_t> P; + P p(5); + assert(p == P(5)); +} diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp new file mode 100644 index 00000000000..47ce6870a3b --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/difference.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// template <class StateT> class fpos + +// Subraction with fpos + +#include <ios> +#include <cassert> + +int main() +{ + typedef std::fpos<std::mbstate_t> P; + P p(11); + P q(6); + std::streamoff o = p - q; + assert(o == 5); +} diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp new file mode 100644 index 00000000000..76f8fa12a41 --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/eq_int.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// template <class StateT> class fpos + +// == and != + +#include <ios> +#include <cassert> + +int main() +{ + typedef std::fpos<std::mbstate_t> P; + P p(5); + P q(6); + assert(p == p); + assert(p != q); +} diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp new file mode 100644 index 00000000000..9c6ebd9f74e --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/offset.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// template <class StateT> class fpos + +// converts to and from streamoff + +#include <ios> +#include <cassert> + +int main() +{ + typedef std::fpos<std::mbstate_t> P; + P p(std::streamoff(7)); + std::streamoff offset(p); + assert(offset == 7); +} diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp new file mode 100644 index 00000000000..eb738b492c8 --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/streamsize.pass.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// streamsize and streamoff interconvert + +#include <ios> +#include <cassert> + +int main() +{ + std::streamoff o(5); + std::streamsize sz(o); + assert(sz == 5); + std::streamoff o2(sz); + assert(o == o2); +} diff --git a/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp new file mode 100644 index 00000000000..f9e6513e4a4 --- /dev/null +++ b/libcxx/test/std/input.output/iostreams.base/fpos/fpos.operations/subtraction.pass.cpp @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <ios> + +// template <class StateT> class fpos + +// Subraction with offset + +#include <ios> +#include <cassert> + +int main() +{ + typedef std::fpos<std::mbstate_t> P; + P p(11); + std::streamoff o(6); + P q = p - o; + assert(q == P(5)); + p -= o; + assert(p == q); +} |