"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libgnucash/engine/test/test-kvp-value.cpp" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

test-kvp-value.cpp  (gnucash-5.0.tar.bz2):test-kvp-value.cpp  (gnucash-5.1.tar.bz2)
skipping to change at line 33 skipping to change at line 33
********************************************************************/ ********************************************************************/
#include <guid.hpp> #include <guid.hpp>
#include "../kvp-value.hpp" #include "../kvp-value.hpp"
#include "../guid.h" #include "../guid.h"
#include "../kvp-frame.hpp" #include "../kvp-frame.hpp"
#include "../gnc-date.h" #include "../gnc-date.h"
#include <memory> #include <memory>
#include <gtest/gtest.h> #include <gtest/gtest.h>
TEST (KvpValueTest, Replace_Frame)
{
auto f1 = new KvpFrameImpl;
std::unique_ptr<KvpValueImpl> v1 {new KvpValueImpl {f1}};
auto f2 = new KvpFrameImpl;
EXPECT_EQ (f1, v1->replace_frame_nc (f2));
v1->set (5.2);
/*f1 and f2 should be deleted now*/
f1 = new KvpFrameImpl;
EXPECT_EQ (nullptr, v1->replace_frame_nc (f1));
delete f1;
}
TEST (KvpValueTest, Equality) TEST (KvpValueTest, Equality)
{ {
std::unique_ptr<KvpValueImpl> v1 {new KvpValueImpl { (int64_t)1}}; std::unique_ptr<KvpValueImpl> v1 {new KvpValueImpl { (int64_t)1}};
std::unique_ptr<KvpValueImpl> v2 {new KvpValueImpl { (int64_t)2}}; std::unique_ptr<KvpValueImpl> v2 {new KvpValueImpl { (int64_t)2}};
EXPECT_LT (compare (*v1, *v2), 0); EXPECT_LT (compare (*v1, *v2), 0);
// This is deleted in the kvpvalue destructor! // This is deleted in the kvpvalue destructor!
auto guid = guid_new (); auto guid = guid_new ();
v1 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {guid}}; v1 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {guid}};
//this guid is also deleted in kvp value destructor. //this guid is also deleted in kvp value destructor.
v2 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {guid_copy (guid)}}; v2 = std::unique_ptr<KvpValueImpl> {new KvpValueImpl {guid_copy (guid)}};
 End of changes. 1 change blocks. 
13 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)