81
|
1 #include "gtest/gtest.h"
|
|
2
|
|
3 #include "../Core/OrthancException.h"
|
|
4 #include "../Core/Compression/ZipWriter.h"
|
|
5
|
|
6
|
|
7 TEST(ZipWriter, Basic)
|
|
8 {
|
|
9 Orthanc::ZipWriter w;
|
|
10 w.SetOutputPath("hello.zip");
|
|
11 w.Open();
|
|
12 w.CreateFileInZip("world/hello");
|
|
13 w.Write("Hello world");
|
|
14 }
|
|
15
|
|
16
|
|
17 TEST(ZipWriter, Exceptions)
|
|
18 {
|
|
19 Orthanc::ZipWriter w;
|
|
20 ASSERT_THROW(w.Open(), Orthanc::OrthancException);
|
|
21 w.SetOutputPath("hello.zip");
|
|
22 w.Open();
|
|
23 ASSERT_THROW(w.Write("hello world"), Orthanc::OrthancException);
|
|
24 }
|