Mercurial > hg > orthanc
comparison UnitTestsSources/ToolboxTests.cpp @ 3713:56f2397f027a storage-commitment
integration mainline->storage-commitment
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Mar 2020 15:42:17 +0100 |
parents | 14b363d972a8 2a170a8f1faf |
children | f9863630ec7f |
comparison
equal
deleted
inserted
replaced
3711:14b363d972a8 | 3713:56f2397f027a |
---|---|
31 **/ | 31 **/ |
32 | 32 |
33 | 33 |
34 #include "PrecompiledHeadersUnitTests.h" | 34 #include "PrecompiledHeadersUnitTests.h" |
35 #include "gtest/gtest.h" | 35 #include "gtest/gtest.h" |
36 #include "../Core/Compatibility.h" | |
37 #include "../Core/IDynamicObject.h" | |
36 #include "../Core/OrthancException.h" | 38 #include "../Core/OrthancException.h" |
37 #include "../Core/Toolbox.h" | 39 #include "../Core/Toolbox.h" |
38 | 40 |
39 using namespace Orthanc; | 41 using namespace Orthanc; |
40 | 42 |
157 std::string s = Toolbox::GenerateDicomPrivateUniqueIdentifier(); | 159 std::string s = Toolbox::GenerateDicomPrivateUniqueIdentifier(); |
158 ASSERT_EQ("2.25.", s.substr(0, 5)); | 160 ASSERT_EQ("2.25.", s.substr(0, 5)); |
159 } | 161 } |
160 | 162 |
161 | 163 |
162 | |
163 #include "../Core/IDynamicObject.h" | |
164 | |
165 #if __cplusplus < 201103L | |
166 /** | |
167 * "std::unique_ptr" was introduced in C++11. We emulate it using | |
168 * boost. "The smart pointer unique_ptr [is] a drop-in replacement for | |
169 * std::unique_ptr, usable also from C++03 compilers." This is only | |
170 * available on Boost >= 1.57.0 (from November 2014). | |
171 * https://www.boost.org/doc/libs/1_57_0/doc/html/move/reference.html#header.boost.move.unique_ptr_hpp | |
172 **/ | |
173 | |
174 #include <boost/move/unique_ptr.hpp> | |
175 | |
176 namespace std | |
177 { | |
178 template <typename T> | |
179 class unique_ptr : public boost::movelib::unique_ptr<T> | |
180 { | |
181 public: | |
182 unique_ptr(T* p) : | |
183 boost::movelib::unique_ptr<T>(p) | |
184 { | |
185 } | |
186 }; | |
187 } | |
188 | |
189 #endif | |
190 | |
191 TEST(Toolbox, UniquePtr) | 164 TEST(Toolbox, UniquePtr) |
192 { | 165 { |
193 std::unique_ptr<int> i(new int(42)); | 166 std::unique_ptr<int> i(new int(42)); |
194 ASSERT_EQ(42, *i); | 167 ASSERT_EQ(42, *i); |
195 | 168 |