about summary refs log tree commit diff
path: root/cpptour/Vector-test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cpptour/Vector-test.cc')
-rw-r--r--cpptour/Vector-test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/cpptour/Vector-test.cc b/cpptour/Vector-test.cc
new file mode 100644
index 0000000..b49ff85
--- /dev/null
+++ b/cpptour/Vector-test.cc
@@ -0,0 +1,20 @@
+#include <iostream>
+#include <stdexcept>
+
+#include "Vector.h"
+
+using namespace std;
+
+void
+neg_length ()
+{
+  try { Vector v (-27); }
+  catch (length_error) { cout << "it's alright" << endl; }
+  catch (bad_alloc) { cout << "BIG OOF!" << endl; }
+}
+
+int
+main ()
+{
+  neg_length ();
+}