summaryrefslogtreecommitdiff
path: root/xsd/tests/cxx/parser/validation/built-in/uri/driver.cxx
blob: daff0c7cac35411a319776f7c92d0f9ad895c0b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// file      : tests/cxx/parser/validation/built-in/uri/driver.cxx
// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
// license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

// Test the built-in anyURI type 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;

int
main ()
{
  // Good.
  //
  {
    uri_pimpl<char> p;
    p.pre ();
    p._pre ();
    p._characters ("  ");
    p._post ();
    assert (p.post_uri () == "");
  }

  {
    uri_pimpl<char> p;
    p.pre ();
    p._pre ();
    p._characters ("relative");
    p._post ();
    assert (p.post_uri () == "relative");
  }

  {
    uri_pimpl<char> p;
    p.pre ();
    p._pre ();
    p._characters ("#id");
    p._post ();
    assert (p.post_uri () == "#id");
  }

  {
    uri_pimpl<char> p;
    p.pre ();
    p._pre ();
    p._characters ("http://www.example.com/foo#bar");
    p._post ();
    assert (p.post_uri () == "http://www.example.com/foo#bar");
  }
}