summaryrefslogtreecommitdiffstats
path: root/tests/list_test.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-02 00:26:21 +0000
committerDavid Robillard <d@drobilla.net>2007-04-02 00:26:21 +0000
commita23b21908e4d0fab277a9f6f7d5a3b5a69746740 (patch)
treea12085c9eb5873d48ecf08ffe030fa2b459d6ef6 /tests/list_test.cpp
parent69559bddc0ae41f1f81241d92675009f86fa79b1 (diff)
downloadraul-a23b21908e4d0fab277a9f6f7d5a3b5a69746740.tar.gz
raul-a23b21908e4d0fab277a9f6f7d5a3b5a69746740.tar.bz2
raul-a23b21908e4d0fab277a9f6f7d5a3b5a69746740.zip
List appending.
Make SMFReader abort gracefully on non-SMF files. git-svn-id: http://svn.drobilla.net/lad/raul@389 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'tests/list_test.cpp')
-rw-r--r--tests/list_test.cpp81
1 files changed, 74 insertions, 7 deletions
diff --git a/tests/list_test.cpp b/tests/list_test.cpp
index faee491..133067b 100644
--- a/tests/list_test.cpp
+++ b/tests/list_test.cpp
@@ -33,7 +33,7 @@ int main()
}
}
- std::cerr << "Removed 4 (by iterator)...\n";
+ cout << "Removed 4 (by iterator)...\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
@@ -41,7 +41,7 @@ int main()
/*l.remove(1);
- std::cerr << "Removed 1 (head) (by value)...\n";
+ cout << "Removed 1 (head) (by value)...\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
@@ -55,7 +55,7 @@ int main()
}
}
- std::cerr << "Removed 2 (head) (by iterator)...\n";
+ cout << "Removed 2 (head) (by iterator)...\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
@@ -63,7 +63,7 @@ int main()
/*l.remove(5);
- std::cerr << "Removed 5 (by value)...\n";
+ cout << "Removed 5 (by value)...\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
@@ -71,7 +71,7 @@ int main()
l.remove(8);
- std::cerr << "Removed 8 (tail) (by value)...\n";
+ cout << "Removed 8 (tail) (by value)...\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
@@ -84,7 +84,7 @@ int main()
}
}
- std::cerr << "Removed 7 (tail) (by iterator)...\n";
+ cout << "Removed 7 (tail) (by iterator)...\n";
for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
cout << *i << endl;
}
@@ -93,9 +93,76 @@ int main()
List<int> r;
r.push_back(new ListNode<int>(9));
r.erase(r.begin());
- std::cerr << "Should not see ANY numbers:\n";
+ cout << "Should not see ANY numbers:\n";
for (List<int>::iterator i = r.begin(); i != r.end(); ++i) {
cout << *i << endl;
}
+
+ cout << "\n\nTesting appending to an empty list:\n";
+ l.clear();
+
+ List<int> l2;
+ l2.push_back(new ListNode<int>(1));
+ l2.push_back(new ListNode<int>(2));
+ l2.push_back(new ListNode<int>(3));
+ l2.push_back(new ListNode<int>(4));
+
+ cout << "l1:\n";
+ for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ cout << "l2:\n";
+ for (List<int>::iterator i = l2.begin(); i != l2.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ l.append(l2);
+ cout << "l1.append(l2):\n";
+ for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ cout << "\n\nAppending non-empty lists:\n";
+ l2.push_back(new ListNode<int>(5));
+ l2.push_back(new ListNode<int>(6));
+ l2.push_back(new ListNode<int>(7));
+ l2.push_back(new ListNode<int>(8));
+
+ cout << "l1:\n";
+ for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ cout << "l2:\n";
+ for (List<int>::iterator i = l2.begin(); i != l2.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ l.append(l2);
+ cout << "l1.append(l2):\n";
+ for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
+ cout << *i << endl;
+ }
+
+
+ cout << "\n\nAppending an empty list:\n";
+
+ cout << "l1:\n";
+ for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ cout << "l2:\n";
+ for (List<int>::iterator i = l2.begin(); i != l2.end(); ++i) {
+ cout << *i << endl;
+ }
+
+ l.append(l2);
+ cout << "l1.append(l2):\n";
+ for (List<int>::iterator i = l.begin(); i != l.end(); ++i) {
+ cout << *i << endl;
+ }
+
return 0;
}