|
From: <vac...@us...> - 2009-05-30 18:56:16
|
Revision: 143
http://xmlwrapp.svn.sourceforge.net/xmlwrapp/?rev=143&view=rev
Author: vaclavslavik
Date: 2009-05-30 18:55:52 +0000 (Sat, 30 May 2009)
Log Message:
-----------
Converted test suite to Boost Test.
Modified Paths:
--------------
trunk/NEWS
trunk/tests/Makefile.am
trunk/tests/document/data/13a.out
trunk/tests/document/data/13b.out
trunk/tests/document/data/14.out
trunk/tests/node/data/07a.out
trunk/tests/node/data/07b.out
trunk/tests/node/data/08a.out
Added Paths:
-----------
trunk/tests/attributes/test_attributes.cxx
trunk/tests/event/test_event.cxx
trunk/tests/node/data/01.out
trunk/tests/node/data/empty.xml
trunk/tests/node/test_node.cxx
trunk/tests/test.h
trunk/tests/test_main.cxx
trunk/tests/tree/data/
trunk/tests/tree/data/bad.xml
trunk/tests/tree/data/good.xml
trunk/tests/tree/data/output
trunk/tests/tree/test_tree.cxx
trunk/tests/xslt/data/input.xml
trunk/tests/xslt/test_xslt.cxx
Removed Paths:
-------------
trunk/tests/attributes/Makefile.am
trunk/tests/attributes/data/05.xml
trunk/tests/attributes/data/05a.out
trunk/tests/attributes/data/05b.out
trunk/tests/attributes/data/05c.out
trunk/tests/attributes/data/05d.out
trunk/tests/attributes/data/06a.out
trunk/tests/attributes/data/06b.out
trunk/tests/attributes/data/07a.out
trunk/tests/attributes/data/07b.out
trunk/tests/attributes/data/07c.out
trunk/tests/attributes/data/07d.out
trunk/tests/attributes/data/09a.out
trunk/tests/attributes/data/09b.out
trunk/tests/attributes/data/09c.out
trunk/tests/attributes/data/10.out
trunk/tests/attributes/runtest.pl
trunk/tests/attributes/test_attr-01.cxx
trunk/tests/attributes/test_attr-02.cxx
trunk/tests/attributes/test_attr-03.cxx
trunk/tests/attributes/test_attr-04.cxx
trunk/tests/attributes/test_attr-05.cxx
trunk/tests/attributes/test_attr-06.cxx
trunk/tests/attributes/test_attr-07.cxx
trunk/tests/attributes/test_attr-08.cxx
trunk/tests/attributes/test_attr-09.cxx
trunk/tests/attributes/test_attr-10.cxx
trunk/tests/document/Makefile.am
trunk/tests/document/data/05.out
trunk/tests/document/data/06.out
trunk/tests/document/data/07.out
trunk/tests/document/data/09.out
trunk/tests/document/data/10.xml
trunk/tests/document/data/11.out
trunk/tests/document/data/12.xml
trunk/tests/document/data/16.out
trunk/tests/document/data/18a.out
trunk/tests/document/data/18b.out
trunk/tests/document/data/18c.out
trunk/tests/document/data/20.out
trunk/tests/document/data/22.out
trunk/tests/document/runtest.pl
trunk/tests/document/test_document-01.cxx
trunk/tests/document/test_document-02.cxx
trunk/tests/document/test_document-03.cxx
trunk/tests/document/test_document-04.cxx
trunk/tests/document/test_document-05.cxx
trunk/tests/document/test_document-06.cxx
trunk/tests/document/test_document-07.cxx
trunk/tests/document/test_document-08.cxx
trunk/tests/document/test_document-09.cxx
trunk/tests/document/test_document-10.cxx
trunk/tests/document/test_document-11.cxx
trunk/tests/document/test_document-12.cxx
trunk/tests/document/test_document-13.cxx
trunk/tests/document/test_document-14.cxx
trunk/tests/document/test_document-15.cxx
trunk/tests/document/test_document-16.cxx
trunk/tests/document/test_document-17.cxx
trunk/tests/document/test_document-18.cxx
trunk/tests/document/test_document-19.cxx
trunk/tests/document/test_document-20.cxx
trunk/tests/document/test_document-21.cxx
trunk/tests/document/test_document-22.cxx
trunk/tests/event/Makefile.am
trunk/tests/event/runtest.pl
trunk/tests/event/test_event-01.cxx
trunk/tests/event/test_event-02.cxx
trunk/tests/event/test_event-03.cxx
trunk/tests/harness/
trunk/tests/node/Makefile.am
trunk/tests/node/data/01.xml
trunk/tests/node/data/02b.out
trunk/tests/node/data/02d.out
trunk/tests/node/data/02e.out
trunk/tests/node/data/02f.out
trunk/tests/node/data/02h.out
trunk/tests/node/data/12.out
trunk/tests/node/data/13.out
trunk/tests/node/runtest.pl
trunk/tests/node/test_node-01.cxx
trunk/tests/node/test_node-02a.cxx
trunk/tests/node/test_node-02b.cxx
trunk/tests/node/test_node-02c.cxx
trunk/tests/node/test_node-02d.cxx
trunk/tests/node/test_node-02e.cxx
trunk/tests/node/test_node-02f.cxx
trunk/tests/node/test_node-02g.cxx
trunk/tests/node/test_node-02h.cxx
trunk/tests/node/test_node-03a.cxx
trunk/tests/node/test_node-03b.cxx
trunk/tests/node/test_node-04a.cxx
trunk/tests/node/test_node-04b.cxx
trunk/tests/node/test_node-05a.cxx
trunk/tests/node/test_node-05b.cxx
trunk/tests/node/test_node-05c.cxx
trunk/tests/node/test_node-05d.cxx
trunk/tests/node/test_node-06.cxx
trunk/tests/node/test_node-07.cxx
trunk/tests/node/test_node-08.cxx
trunk/tests/node/test_node-09.cxx
trunk/tests/node/test_node-10.cxx
trunk/tests/node/test_node-11.cxx
trunk/tests/node/test_node-12.cxx
trunk/tests/node/test_node-13.cxx
trunk/tests/node/test_node-14.cxx
trunk/tests/tree/Makefile.am
trunk/tests/tree/runtest.pl
trunk/tests/tree/test_tree-01.cxx
trunk/tests/tree/test_tree-02.cxx
trunk/tests/tree/test_tree-03.cxx
trunk/tests/tree/test_tree-04.cxx
trunk/tests/tree/test_tree-05.cxx
trunk/tests/tree/test_tree-06.cxx
trunk/tests/xslt/Makefile.am
trunk/tests/xslt/data/02a.xml
trunk/tests/xslt/data/03a.xml
trunk/tests/xslt/data/04a.out
trunk/tests/xslt/data/04a.xml
trunk/tests/xslt/data/04a.xsl
trunk/tests/xslt/data/05a.out
trunk/tests/xslt/data/05a.xml
trunk/tests/xslt/data/05a.xsl
trunk/tests/xslt/runtest.pl
trunk/tests/xslt/test_xslt-01.cxx
trunk/tests/xslt/test_xslt-02.cxx
trunk/tests/xslt/test_xslt-03.cxx
trunk/tests/xslt/test_xslt-04.cxx
trunk/tests/xslt/test_xslt-05.cxx
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/NEWS 2009-05-30 18:55:52 UTC (rev 143)
@@ -3,6 +3,8 @@
Fixed xml::event_parser::parse_stream() to return false on empty
input (Michael Grundberg, #2787836).
+ Converted test suite to Boost Test.
+
Version 0.6.0
Fixed libxmlwrapp to not depend on libxslt if XSLT support
Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/Makefile.am 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,10 +1,22 @@
-SUBDIRS = \
- attributes \
- document \
- event \
- node \
- tree \
- xslt
+TESTS = test
-EXTRA_DIST = harness/harness.pm
+AM_CPPFLAGS = -I$(top_srcdir)/include
+LIBS = $(top_builddir)/src/libxmlwrapp.la \
+ -lboost_unit_test_framework \
+ -lboost_iostreams
+
+noinst_PROGRAMS = test
+
+test_SOURCES = \
+ test_main.cxx \
+ attributes/test_attributes.cxx \
+ document/test_document.cxx \
+ event/test_event.cxx \
+ node/test_node.cxx \
+ tree/test_tree.cxx
+
+if WITH_XSLT
+LIBS += $(top_builddir)/src/libxsltwrapp.la
+test_SOURCES += xslt/test_xslt.cxx
+endif
Deleted: trunk/tests/attributes/Makefile.am
===================================================================
--- trunk/tests/attributes/Makefile.am 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/Makefile.am 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,30 +0,0 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-LIBS = ../../src/libxmlwrapp.la
-
-TESTS = runtest.pl
-
-noinst_PROGRAMS = \
- test_attr-01 \
- test_attr-02 \
- test_attr-03 \
- test_attr-04 \
- test_attr-05 \
- test_attr-06 \
- test_attr-07 \
- test_attr-08 \
- test_attr-09 \
- test_attr-10
-
-test_attr_01_SOURCES = test_attr-01.cxx
-test_attr_02_SOURCES = test_attr-02.cxx
-test_attr_03_SOURCES = test_attr-03.cxx
-test_attr_04_SOURCES = test_attr-04.cxx
-test_attr_05_SOURCES = test_attr-05.cxx
-test_attr_06_SOURCES = test_attr-06.cxx
-test_attr_07_SOURCES = test_attr-07.cxx
-test_attr_08_SOURCES = test_attr-08.cxx
-test_attr_09_SOURCES = test_attr-09.cxx
-test_attr_10_SOURCES = test_attr-10.cxx
-
-EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml $(srcdir)/data/*.dtd runtest.pl
Deleted: trunk/tests/attributes/data/05.xml
===================================================================
--- trunk/tests/attributes/data/05.xml 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05.xml 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-<root attr_one="one" attr_two="two" attr_three="three" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05a.out
===================================================================
--- trunk/tests/attributes/data/05a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_two="two" attr_three="three" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05b.out
===================================================================
--- trunk/tests/attributes/data/05b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_one="one" attr_three="three" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05c.out
===================================================================
--- trunk/tests/attributes/data/05c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_one="one" attr_two="two" attr_four="four"/>
Deleted: trunk/tests/attributes/data/05d.out
===================================================================
--- trunk/tests/attributes/data/05d.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/05d.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root attr_one="one" attr_two="two" attr_three="three"/>
Deleted: trunk/tests/attributes/data/06a.out
===================================================================
--- trunk/tests/attributes/data/06a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/06a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-1
Deleted: trunk/tests/attributes/data/06b.out
===================================================================
--- trunk/tests/attributes/data/06b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/06b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-0
Deleted: trunk/tests/attributes/data/07a.out
===================================================================
--- trunk/tests/attributes/data/07a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-0
Deleted: trunk/tests/attributes/data/07b.out
===================================================================
--- trunk/tests/attributes/data/07b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-1
Deleted: trunk/tests/attributes/data/07c.out
===================================================================
--- trunk/tests/attributes/data/07c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-2
Deleted: trunk/tests/attributes/data/07d.out
===================================================================
--- trunk/tests/attributes/data/07d.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/07d.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-3
Deleted: trunk/tests/attributes/data/09a.out
===================================================================
--- trunk/tests/attributes/data/09a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/09a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +0,0 @@
-1
-notend
-end
Deleted: trunk/tests/attributes/data/09b.out
===================================================================
--- trunk/tests/attributes/data/09b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/09b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +0,0 @@
-two
-notend
-end
Deleted: trunk/tests/attributes/data/09c.out
===================================================================
--- trunk/tests/attributes/data/09c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/09c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +0,0 @@
-three
-notend
-end
Deleted: trunk/tests/attributes/data/10.out
===================================================================
--- trunk/tests/attributes/data/10.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/data/10.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-****END****
Deleted: trunk/tests/attributes/runtest.pl
===================================================================
--- trunk/tests/attributes/runtest.pl 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/runtest.pl 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,141 +0,0 @@
-#!/usr/bin/perl
-###########################################################################
-# Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
-# All Rights Reserved
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-# 3. Neither the name of the Author nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
-# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-###########################################################################
-
-use strict;
-use lib qw(../harness);
-use harness;
-
-my $test = harness->new("xml::attributes");
-runtests();
-
-###########################################################################
-sub runtests {
- my $actual_result;
- my $good_result;
-
- ###########################################################################
- foreach (qw(01a 01b 01c)) {
- $test->start("iteration ($_)");
- $actual_result = `./test_attr-01 data/$_.xml 2>&1`;
-
- if ($? != 0) {
- $test->fail("test process returned $?");
- } else {
- $good_result = $test->slurp_file("data/$_.out");
-
- my $hash_a = make_hash($actual_result);
- my $hash_b = make_hash($good_result);
-
- if (not comp_hash($hash_a, $hash_b)) {
- $test->fail('output did not match expected value');
- } else {
- $test->pass();
- }
- }
- }
- ###########################################################################
- $test->regression("insert(name, value) (02)", "./test_attr-02 data/02.xml", "data/02.out");
- ###########################################################################
- foreach my $pair ((['one', 0], ['two', 0], ['three', 0], ['missing', 1], ['also_missing', 1])) {
- $test->run_test_exit_status("find(name) (03)", "./test_attr-03 data/03.xml $pair->[0]", $pair->[1]);
- }
- ###########################################################################
- foreach my $pair ((['a', 'attr_one'], ['b', 'attr_two'], ['c', 'attr_three'], ['d', 'attr_four'])) {
- $test->regression("remove(iterator) (04$pair->[0])", "./test_attr-04 data/04.xml $pair->[1]", "data/04$pair->[0].out");
- }
- ###########################################################################
- foreach my $pair ((['a', 'attr_one'], ['b', 'attr_two'], ['c', 'attr_three'], ['d', 'attr_four'])) {
- $test->regression("remove(const char*) (05$pair->[0])", "./test_attr-05 data/05.xml $pair->[1]", "data/05$pair->[0].out");
- }
- ###########################################################################
- foreach (qw(a b)) {
- $test->regression("empty (06$_)", "./test_attr-06 data/06$_.xml", "data/06$_.out");
- }
- ###########################################################################
- foreach (qw(a b c d)) {
- $test->regression("size (07$_)", "./test_attr-07 data/07$_.xml", "data/07$_.out");
- }
- ###########################################################################
- $test->start("copy constructor (08)");
- $actual_result = `./test_attr-08 data/08.xml 2>&1`;
-
- if ($? != 0) {
- $test->fail("test process returned $?");
- } else {
- $good_result = $test->slurp_file("data/08.out");
-
- my $hash_a = make_hash($actual_result);
- my $hash_b = make_hash($good_result);
-
- if (not comp_hash($hash_a, $hash_b)) {
- $test->fail('output did not match expected value');
- } else {
- $test->pass();
- }
- }
- ###########################################################################
- foreach ((['a', 'one'], ['b', 'two'], ['c', 'three'])) {
- $test->regression("dtd attr (09$_->[0])", "./test_attr-09 data/09.xml $_->[1]", "data/09$_->[0].out");
- }
- ###########################################################################
- $test->regression("dtd implied (10)", "./test_attr-10 data/10.xml optional", "data/10.out");
- ###########################################################################
-}
-###########################################################################
-sub make_hash {
- my $data = shift;
- my ($key, $value);
- my %hash;
-
- foreach my $line (split(/\n/, $data)) {
- my ($key, $value) = split(/=/, $line, 2);
- next if not defined $key or not defined $value;
- $hash{$key} = $value;
- }
-
- return \%hash;
-}
-###########################################################################
-sub comp_hash {
- my $hash_a = shift;
- my $hash_b = shift;
-
- if (scalar keys %$hash_a != scalar keys %$hash_b) { return 0; }
- foreach my $key (keys %$hash_a) {
- if (not exists $hash_b->{$key}) { return 0; }
- if ($hash_a->{$key} ne $hash_b->{$key}) { return 0; }
- }
-
- return 1;
-}
-###########################################################################
Deleted: trunk/tests/attributes/test_attr-01.cxx
===================================================================
--- trunk/tests/attributes/test_attr-01.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-01.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes function can see all the attributes of
- * a node.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.begin(), end=attrs.end();
- for (; i!=end; ++i) { std::cout << i->get_name() << "=" << i->get_value() << "\n"; }
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-02.cxx
===================================================================
--- trunk/tests/attributes/test_attr-02.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-02.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::insert function works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- attrs.insert("b", "b");
-
- std::cout << parser.get_document();
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-03.cxx
===================================================================
--- trunk/tests/attributes/test_attr-03.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-03.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::find works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.find(argv[2]);
-
- if (i == attrs.end()) return 1;
- return 0;
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-04.cxx
===================================================================
--- trunk/tests/attributes/test_attr-04.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-04.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::remove(iterator) works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::iterator i=attrs.find(argv[2]);
-
- if (i == attrs.end()) return 1;
- attrs.erase(i);
-
- std::cout << parser.get_document();
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-05.cxx
===================================================================
--- trunk/tests/attributes/test_attr-05.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-05.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::remove(const char*) works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- attrs.erase(argv[2]);
-
- std::cout << parser.get_document();
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-06.cxx
===================================================================
--- trunk/tests/attributes/test_attr-06.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-06.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes::empty() works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- std::cout << attrs.empty() << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-07.cxx
===================================================================
--- trunk/tests/attributes/test_attr-07.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-07.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if xml::attributes::size() works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- std::cout << attrs.size() << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-08.cxx
===================================================================
--- trunk/tests/attributes/test_attr-08.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-08.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if the xml::attributes copy constructor works.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 2) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- /* MAKE A COPY! */
- xml::attributes attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.begin(), end=attrs.end();
- for (; i!=end; ++i) std::cout << i->get_name() << "=" << i->get_value() << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-09.cxx
===================================================================
--- trunk/tests/attributes/test_attr-09.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-09.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if xml::attributes::find() can see DTD default attributes
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) {
- std::cerr << "xml not valid\n";
- return 1;
- }
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.find(argv[2]);
-
- std::cout << i->get_value() << "\n";
- std::cout << (i == attrs.end() ? "end" : "notend") << "\n";
-
- ++i;
-
- std::cout << (i == attrs.end() ? "end" : "notend") << "\n";
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Deleted: trunk/tests/attributes/test_attr-10.cxx
===================================================================
--- trunk/tests/attributes/test_attr-10.cxx 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/attributes/test_attr-10.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
- * All Rights Reserved
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of the Author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Test to see if xml::attributes::find() will die when DTD default
- * attributes are really implied.
- */
-
-#include <xmlwrapp/xmlwrapp.h>
-#include <iostream>
-
-int main (int argc, char *argv[]) {
- if (argc != 3) return 1;
-
- try {
- xml::tree_parser parser(argv[1]);
-
- if (parser.get_document().has_internal_subset() && !parser.get_document().validate()) {
- std::cerr << "xml not valid\n";
- return 1;
- }
-
- xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
- xml::attributes::const_iterator i=attrs.find(argv[2]);
-
- if (i == attrs.end()) std::cout << "****END****\n";
- else std::cout << i->get_value() << "\n";
-
- } catch ( ... ) { return 1; }
-
- return 0;
-}
Added: trunk/tests/attributes/test_attributes.cxx
===================================================================
--- trunk/tests/attributes/test_attributes.cxx (rev 0)
+++ trunk/tests/attributes/test_attributes.cxx 2009-05-30 18:55:52 UTC (rev 143)
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
+ * Copyright (C) 2009 Vaclav Slavik (vs...@fa...)
+ * All Rights Reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name of the Author nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "../test.h"
+
+
+BOOST_AUTO_TEST_SUITE( attributes )
+
+/*
+ * Test to see if the xml::attributes function can see all the attributes of
+ * a node.
+ */
+
+static void do_attr_read(const std::string& prefix)
+{
+ std::ostringstream ostr;
+
+ xml::tree_parser parser(test_file_path(prefix + ".xml").c_str());
+
+ const xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ xml::attributes::const_iterator i=attrs.begin(), end=attrs.end();
+ for (; i!=end; ++i)
+ {
+ ostr << i->get_name() << "=" << i->get_value() << "\n";
+ }
+
+ BOOST_CHECK( is_same_as_file(ostr, prefix + ".out") );
+}
+
+BOOST_AUTO_TEST_CASE( read )
+{
+ do_attr_read("attributes/data/01a");
+ do_attr_read("attributes/data/01b");
+ do_attr_read("attributes/data/01c");
+}
+
+
+/*
+ * Test to see if the xml::attributes::insert function works.
+ */
+
+BOOST_AUTO_TEST_CASE( insert )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/02.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ attrs.insert("b", "b");
+
+ BOOST_CHECK( is_same_as_file(parser.get_document(), "attributes/data/02.out") );
+}
+
+
+/*
+ * Test to see if the xml::attributes::find works.
+ */
+
+static bool do_attr_find(const xml::document& doc,
+ const char *to_find,
+ const char *expected_value)
+{
+ const xml::attributes &attrs = doc.get_root_node().get_attributes();
+ xml::attributes::const_iterator i = attrs.find(to_find);
+
+ if ( i == attrs.end() )
+ return false;
+
+ BOOST_CHECK_EQUAL( i->get_name(), to_find );
+ BOOST_CHECK_EQUAL( i->get_value(), expected_value );
+
+ return true;
+}
+
+BOOST_AUTO_TEST_CASE( find )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/03.xml").c_str());
+ const xml::document& doc = parser.get_document();
+
+ BOOST_CHECK( do_attr_find(doc, "one", "1") == true );
+ BOOST_CHECK( do_attr_find(doc, "two", "2") == true );
+ BOOST_CHECK( do_attr_find(doc, "three", "3") == true );
+ BOOST_CHECK( do_attr_find(doc, "missing", NULL) == false );
+ BOOST_CHECK( do_attr_find(doc, "also_missing", NULL) == false );
+}
+
+
+/*
+ * Test to see if the xml::attributes::remove(iterator) works.
+ */
+
+static void do_remove_by_iter(const char *name, const char *outfile)
+{
+ xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ xml::attributes::iterator i = attrs.find(name);
+
+ BOOST_REQUIRE( i != attrs.end() );
+ attrs.erase(i);
+
+ BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) );
+}
+
+BOOST_AUTO_TEST_CASE( remove_by_iter )
+{
+ do_remove_by_iter("attr_one", "attributes/data/04a.out");
+ do_remove_by_iter("attr_two", "attributes/data/04b.out");
+ do_remove_by_iter("attr_three", "attributes/data/04c.out");
+ do_remove_by_iter("attr_four", "attributes/data/04d.out");
+}
+
+
+/*
+ * Test to see if the xml::attributes::remove(const char*) works.
+ */
+
+static void do_remove_by_name(const char *name, const char *outfile)
+{
+ xml::tree_parser parser(test_file_path("attributes/data/04.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+
+ attrs.erase(name);
+
+ BOOST_CHECK( is_same_as_file(parser.get_document(), outfile) );
+}
+
+BOOST_AUTO_TEST_CASE( remove_by_name )
+{
+ do_remove_by_name("attr_one", "attributes/data/04a.out");
+ do_remove_by_name("attr_two", "attributes/data/04b.out");
+ do_remove_by_name("attr_three", "attributes/data/04c.out");
+ do_remove_by_name("attr_four", "attributes/data/04d.out");
+}
+
+
+/*
+ * Test to see if xml::attributes::find() can see DTD default attributes
+ */
+
+BOOST_AUTO_TEST_CASE( find_dtd_default_attr )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/09.xml").c_str());
+
+ BOOST_CHECK( parser.get_document().has_internal_subset() );
+ BOOST_CHECK( parser.get_document().validate() );
+
+ const xml::attributes &attrs =
+ parser.get_document().get_root_node().get_attributes();
+
+ {
+ xml::attributes::const_iterator i = attrs.find("one");
+ BOOST_REQUIRE( i != attrs.end() );
+ BOOST_CHECK_EQUAL( i->get_value(), "1" );
+ ++i;
+ BOOST_CHECK( i == attrs.end() );
+ }
+
+ {
+ xml::attributes::const_iterator i = attrs.find("two");
+ BOOST_REQUIRE( i != attrs.end() );
+ BOOST_CHECK_EQUAL( i->get_value(), "two" );
+ ++i;
+ BOOST_CHECK( i == attrs.end() );
+ }
+
+ {
+ xml::attributes::const_iterator i = attrs.find("three");
+ BOOST_REQUIRE( i != attrs.end() );
+ BOOST_CHECK_EQUAL( i->get_value(), "three" );
+ ++i;
+ BOOST_CHECK( i == attrs.end() );
+ }
+}
+
+
+/*
+ * Test to see if xml::attributes::find() will die when DTD default
+ * attributes are really implied.
+ */
+
+BOOST_AUTO_TEST_CASE( dtd_implied )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/10.xml").c_str());
+
+ BOOST_CHECK( parser.get_document().has_internal_subset() );
+ BOOST_CHECK( parser.get_document().validate() );
+
+ const xml::attributes &attrs =
+ parser.get_document().get_root_node().get_attributes();
+
+ BOOST_CHECK( attrs.find("optional") == attrs.end() );
+}
+
+
+/*
+ * Test to see if the xml::attributes copy constructor works.
+ */
+
+BOOST_AUTO_TEST_CASE( attr_copy_ctor )
+{
+ std::ostringstream ostr;
+ xml::tree_parser parser(test_file_path("attributes/data/08.xml").c_str());
+
+ // make a copy
+ xml::attributes attrs = parser.get_document().get_root_node().get_attributes();
+ xml::attributes::const_iterator i = attrs.begin(), end = attrs.end();
+
+ for ( ; i != end; ++i )
+ ostr << i->get_name() << "=" << i->get_value() << "\n";
+
+ BOOST_CHECK( is_same_as_file(ostr, "attributes/data/08.out") );
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+
+/*
+ * Test to see if the xml::attributes::empty() works.
+ */
+
+BOOST_AUTO_TEST_CASE( attr_empty_a )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/06a.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+
+ BOOST_CHECK( attrs.empty() );
+}
+
+BOOST_AUTO_TEST_CASE( attr_empty_b )
+{
+ xml::tree_parser parser(test_file_path("attributes/data/06b.xml").c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+
+ BOOST_CHECK( !attrs.empty() );
+}
+
+
+/*
+ * Test to see if xml::attributes::size() works.
+ */
+
+static int do_get_attr_size(const char *testfile)
+{
+ xml::tree_parser parser(test_file_path(testfile).c_str());
+
+ xml::attributes &attrs = parser.get_document().get_root_node().get_attributes();
+ return attrs.size();
+}
+
+BOOST_AUTO_TEST_CASE( attr_size )
+{
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07a.xml"), 0 );
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07b.xml"), 1 );
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07c.xml"), 2 );
+ BOOST_CHECK_EQUAL( do_get_attr_size("attributes/data/07d.xml"), 3 );
+}
Deleted: trunk/tests/document/Makefile.am
===================================================================
--- trunk/tests/document/Makefile.am 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/Makefile.am 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,54 +0,0 @@
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-LIBS = ../../src/libxmlwrapp.la
-
-TESTS = runtest.pl
-
-noinst_PROGRAMS = \
- test_document-01 \
- test_document-02 \
- test_document-03 \
- test_document-04 \
- test_document-05 \
- test_document-06 \
- test_document-07 \
- test_document-08 \
- test_document-09 \
- test_document-10 \
- test_document-11 \
- test_document-12 \
- test_document-13 \
- test_document-14 \
- test_document-15 \
- test_document-16 \
- test_document-17 \
- test_document-18 \
- test_document-19 \
- test_document-20 \
- test_document-21 \
- test_document-22
-
-test_document_01_SOURCES = test_document-01.cxx
-test_document_02_SOURCES = test_document-02.cxx
-test_document_03_SOURCES = test_document-03.cxx
-test_document_04_SOURCES = test_document-04.cxx
-test_document_05_SOURCES = test_document-05.cxx
-test_document_06_SOURCES = test_document-06.cxx
-test_document_07_SOURCES = test_document-07.cxx
-test_document_08_SOURCES = test_document-08.cxx
-test_document_09_SOURCES = test_document-09.cxx
-test_document_10_SOURCES = test_document-10.cxx
-test_document_11_SOURCES = test_document-11.cxx
-test_document_12_SOURCES = test_document-12.cxx
-test_document_13_SOURCES = test_document-13.cxx
-test_document_14_SOURCES = test_document-14.cxx
-test_document_15_SOURCES = test_document-15.cxx
-test_document_16_SOURCES = test_document-16.cxx
-test_document_17_SOURCES = test_document-17.cxx
-test_document_18_SOURCES = test_document-18.cxx
-test_document_19_SOURCES = test_document-19.cxx
-test_document_20_SOURCES = test_document-20.cxx
-test_document_21_SOURCES = test_document-21.cxx
-test_document_22_SOURCES = test_document-22.cxx
-
-EXTRA_DIST = $(srcdir)/data/*.out $(srcdir)/data/*.xml runtest.pl
Deleted: trunk/tests/document/data/05.out
===================================================================
--- trunk/tests/document/data/05.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/05.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root>pcdata</root>
Deleted: trunk/tests/document/data/06.out
===================================================================
--- trunk/tests/document/data/06.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/06.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root>pcdata</root>
Deleted: trunk/tests/document/data/07.out
===================================================================
--- trunk/tests/document/data/07.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/07.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.0"?>
-<root>pcdata</root>
Deleted: trunk/tests/document/data/09.out
===================================================================
--- trunk/tests/document/data/09.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/09.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-1.1
Deleted: trunk/tests/document/data/10.xml
===================================================================
--- trunk/tests/document/data/10.xml 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/10.xml 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,2 +0,0 @@
-<?xml version="1.1"?>
-<root/>
Deleted: trunk/tests/document/data/11.out
===================================================================
--- trunk/tests/document/data/11.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/11.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-UTF-8
Deleted: trunk/tests/document/data/12.xml
===================================================================
--- trunk/tests/document/data/12.xml 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/12.xml 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-<root/>
Modified: trunk/tests/document/data/13a.out
===================================================================
--- trunk/tests/document/data/13a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/13a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +1,2 @@
-0
<?xml version="1.0" standalone="yes"?>
<root/>
Modified: trunk/tests/document/data/13b.out
===================================================================
--- trunk/tests/document/data/13b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/13b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,3 +1,2 @@
-1
<?xml version="1.0" standalone="no"?>
<root/>
Modified: trunk/tests/document/data/14.out
===================================================================
--- trunk/tests/document/data/14.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/14.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,4 +1,3 @@
-1
<?xml version="1.0"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
<child>
Deleted: trunk/tests/document/data/16.out
===================================================================
--- trunk/tests/document/data/16.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/16.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,5 +0,0 @@
-1
-2
-2
-1
-1
Deleted: trunk/tests/document/data/18a.out
===================================================================
--- trunk/tests/document/data/18a.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/18a.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::push_back can't take element type nodes
Deleted: trunk/tests/document/data/18b.out
===================================================================
--- trunk/tests/document/data/18b.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/18b.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::insert can't take element type nodes
Deleted: trunk/tests/document/data/18c.out
===================================================================
--- trunk/tests/document/data/18c.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/18c.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::insert can't take element type nodes
Deleted: trunk/tests/document/data/20.out
===================================================================
--- trunk/tests/document/data/20.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/20.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::replace can't replace element type nodes
Deleted: trunk/tests/document/data/22.out
===================================================================
--- trunk/tests/document/data/22.out 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/data/22.out 2009-05-30 18:55:52 UTC (rev 143)
@@ -1 +0,0 @@
-xml::document::erase can't erase element type nodes
Deleted: trunk/tests/document/runtest.pl
===================================================================
--- trunk/tests/document/runtest.pl 2009-05-17 18:56:30 UTC (rev 142)
+++ trunk/tests/document/runtest.pl 2009-05-30 18:55:52 UTC (rev 143)
@@ -1,89 +0,0 @@
-#!/usr/bin/perl
-###########################################################################
-# Copyright (C) 2001-2003 Peter J Jones (pj...@pm...)
-# All Rights Reserved
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions ...
[truncated message content] |