diff UnitTests/Zip.cpp @ 81:0ec5e2e327b1

zip writer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 24 Sep 2012 10:33:41 +0200
parents
children c9b3ba0fd140
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UnitTests/Zip.cpp	Mon Sep 24 10:33:41 2012 +0200
@@ -0,0 +1,24 @@
+#include "gtest/gtest.h"
+
+#include "../Core/OrthancException.h"
+#include "../Core/Compression/ZipWriter.h"
+
+
+TEST(ZipWriter, Basic)
+{
+  Orthanc::ZipWriter w;
+  w.SetOutputPath("hello.zip");
+  w.Open();
+  w.CreateFileInZip("world/hello");
+  w.Write("Hello world");
+}
+
+
+TEST(ZipWriter, Exceptions)
+{
+  Orthanc::ZipWriter w;
+  ASSERT_THROW(w.Open(), Orthanc::OrthancException);
+  w.SetOutputPath("hello.zip");
+  w.Open();
+  ASSERT_THROW(w.Write("hello world"), Orthanc::OrthancException);
+}