view UnitTests/Zip.cpp @ 166:857856b827e5 Orthanc-0.2.3

news
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Oct 2012 16:15:29 +0200
parents 0ec5e2e327b1
children c9b3ba0fd140
line wrap: on
line source

#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);
}