diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 |
commit | 4538829ab86b5a1cd4e845e7eab165029c9d6d46 (patch) | |
tree | bbadf39aed0610c8f8f7b41fefff47773b8ac205 /xsd/tests/cxx/parser/validation/built-in/int/driver.cxx | |
parent | 23d41842168ac1a1580111b9c5c73500ceee3d57 (diff) | |
parent | aad5ad9bf0c02aa4e79bc6b7d6c934612fff4026 (diff) |
Update upstream source from tag 'upstream/4.2.0'
Update to upstream version '4.2.0'
with Debian dir 1b38df7bbcf313223de3c50107ac0255090fe647
Diffstat (limited to 'xsd/tests/cxx/parser/validation/built-in/int/driver.cxx')
-rw-r--r-- | xsd/tests/cxx/parser/validation/built-in/int/driver.cxx | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/xsd/tests/cxx/parser/validation/built-in/int/driver.cxx b/xsd/tests/cxx/parser/validation/built-in/int/driver.cxx deleted file mode 100644 index 8d4392b..0000000 --- a/xsd/tests/cxx/parser/validation/built-in/int/driver.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// file : tests/cxx/parser/validation/built-in/int/driver.cxx -// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -// Test the built-in int and unsigned int types validation. -// -#include <cassert> - -#include <xsd/cxx/parser/validating/exceptions.hxx> -#include <xsd/cxx/parser/validating/xml-schema-pimpl.hxx> - -using namespace xsd::cxx::parser::validating; - -template <typename T> -bool -test_post_fail (T& p) -{ - try - { - p._post (); - } - catch (invalid_value<char> const&) - { - return true; - } - - return false; -} - -int -main () -{ - // Good. - // - { - int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("-2147483648"); - p._post (); - assert (p.post_int () == -2147483648); - } - - { - int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("0"); - p._post (); - assert (p.post_int () == 0); - } - - { - int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("2147483647"); - p._post (); - assert (p.post_int () == 2147483647); - } - - { - unsigned_int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("0"); - p._post (); - assert (p.post_unsigned_int () == 0); - } - - { - unsigned_int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("4294967295"); - p._post (); - assert (p.post_unsigned_int () == 4294967295); - } - - // Bad - // - - { - unsigned_int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("-123"); - assert (test_post_fail (p)); - } - - - // Ranges - // - { - int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("-2147483649"); - assert (test_post_fail (p)); - } - - { - int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("2147483648"); - assert (test_post_fail (p)); - } - - { - unsigned_int_pimpl<char> p; - p.pre (); - p._pre (); - p._characters ("4294967296"); - assert (test_post_fail (p)); - } -} |