From 088381cc7b99c35a7238c75a016501e86d6b0f02 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Mon, 11 Feb 2013 15:54:35 +0100 Subject: [PATCH] DPL testcase description moved from wrt-extra [Issue#] N/A [Bug] Test description was not moved to wrt-commons [Cause] N/A [Solution] Moving it from wrt-extra history [Verification] Build repository Change-Id: I6c0e8ef022bc9cc277a49998e7c00b8f189a9761 --- tests/dpl/core/test_address.cpp | 20 ++++ tests/dpl/core/test_binary_queue.cpp | 117 ++++++++++++++++++ tests/dpl/core/test_fast_delegate.cpp | 5 + tests/dpl/core/test_foreach.cpp | 5 + tests/dpl/core/test_log_unhandled_exception.cpp | 21 ++++ tests/dpl/core/test_once.cpp | 5 + tests/dpl/core/test_scoped_array.cpp | 20 ++++ tests/dpl/core/test_scoped_fclose.cpp | 15 +++ tests/dpl/core/test_scoped_free.cpp | 15 +++ tests/dpl/core/test_scoped_ptr.cpp | 20 ++++ tests/dpl/core/test_semaphore.cpp | 5 + tests/dpl/core/test_serialization.cpp | 42 +++++++ tests/dpl/core/test_shared_ptr.cpp | 31 +++++ tests/dpl/core/test_string.cpp | 35 ++++++ tests/dpl/core/test_thread.cpp | 5 + tests/dpl/core/test_type_list.cpp | 5 + tests/dpl/core/test_zip_input.cpp | 15 +++ tests/dpl/db/test_orm.cpp | 75 ++++++++++++ tests/dpl/db/test_sql_connection.cpp | 25 ++++ tests/dpl/dbus/test_cases.cpp | 25 ++++ tests/dpl/event/test_controller.cpp | 39 ++++++ tests/dpl/event/test_event_support.cpp | 12 ++ tests/dpl/event/test_ic_delegate.cpp | 20 ++++ tests/dpl/event/test_property.cpp | 5 + tests/dpl/utils/bash_utils.cpp | 5 + tests/dpl/utils/widget_version.cpp | 151 ++++++++++++++++++++++++ tests/dpl/utils/wrt_utility.cpp | 15 +++ 27 files changed, 753 insertions(+) diff --git a/tests/dpl/core/test_address.cpp b/tests/dpl/core/test_address.cpp index 7aff2df..d887ca0 100644 --- a/tests/dpl/core/test_address.cpp +++ b/tests/dpl/core/test_address.cpp @@ -24,24 +24,44 @@ RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: Address_InitialEmpty +Description: tests empty constructor of DPL::Address +Expected: string version of empy address equals ":0" +*/ RUNNER_TEST(Address_InitialEmpty) { DPL::Address address; RUNNER_ASSERT(address.ToString() == ":0"); } +/* +Name: Address_InitialAddress +Description: tests constructor of DPL::Address with name only +Expected: string version of address equals given name and appended ":0" +*/ RUNNER_TEST(Address_InitialAddress) { DPL::Address address("www.sample.com"); RUNNER_ASSERT(address.ToString() == "www.sample.com:0"); } +/* +Name: Address_InitialAddress +Description: tests constructor of DPL::Address with name and port +Expected: string version of address should look lik "adress name:port" +*/ RUNNER_TEST(Address_InitialAddressPort) { DPL::Address address("www.somewhere.com", 8080); RUNNER_ASSERT(address.ToString() == "www.somewhere.com:8080"); } +/* +Name: Address_InitialAddress +Description: tests getter of address +Expected: address name and port should matches those passed in constructor +*/ RUNNER_TEST(Address_Getters) { DPL::Address address("www.somewhere.com", 8080); diff --git a/tests/dpl/core/test_binary_queue.cpp b/tests/dpl/core/test_binary_queue.cpp index add6ed2..cd8931d 100644 --- a/tests/dpl/core/test_binary_queue.cpp +++ b/tests/dpl/core/test_binary_queue.cpp @@ -32,18 +32,33 @@ inline std::string BinaryQueueToString(const DPL::BinaryQueue &queue) return result; } +/* +Name: BinaryQueue_InitialEmpty +Description: tests emptiness of new constructed queue +Expected: new queue should be empty +*/ RUNNER_TEST(BinaryQueue_InitialEmpty) { DPL::BinaryQueue queue; RUNNER_ASSERT(queue.Empty() == true); } +/* +Name: BinaryQueue_InitialSize +Description: tests emptiness of new constructed queue +Expected: new queue size should be equal 0 +*/ RUNNER_TEST(BinaryQueue_InitialSize) { DPL::BinaryQueue queue; RUNNER_ASSERT(queue.Size() == 0); } +/* +Name: BinaryQueue_InitialCopy +Description: tests emptiness of new copy-constructed empty queue +Expected: queue constructed on base on empty queue should be empty +*/ RUNNER_TEST(BinaryQueue_InitialCopy) { DPL::BinaryQueue queue; @@ -52,24 +67,44 @@ RUNNER_TEST(BinaryQueue_InitialCopy) RUNNER_ASSERT(copy.Size() == 0); } +/* +Name: BinaryQueue_InitialConsumeZero +Description: tests consume method accepts 0 bytes +Expected: it should be avaliable to discard 0 bytes from empty queue +*/ RUNNER_TEST(BinaryQueue_InitialConsumeZero) { DPL::BinaryQueue queue; queue.Consume(0); } +/* +Name: BinaryQueue_InitialFlattenConsumeZero +Description: tests returning data from queue and discarding +Expected: it should be able to call flattenconsume with empty buffer if 0 bytes are read +*/ RUNNER_TEST(BinaryQueue_InitialFlattenConsumeZero) { DPL::BinaryQueue queue; queue.FlattenConsume(NULL, 0); } +/* +Name: BinaryQueue_InitialFlattenZero +Description: tests returning data from queue +Expected: it should be able to call flatten with empty buffer if 0 bytes are read +*/ RUNNER_TEST(BinaryQueue_InitialFlattenZero) { DPL::BinaryQueue queue; queue.Flatten(NULL, 0); } +/* +Name: BinaryQueue_InitialConsumeOne +Description: tests discarding more bytes than it is avaliable +Expected: exception throw +*/ RUNNER_TEST(BinaryQueue_InitialConsumeOne) { DPL::BinaryQueue queue; @@ -86,6 +121,11 @@ RUNNER_TEST(BinaryQueue_InitialConsumeOne) RUNNER_FAIL; } +/* +Name: BinaryQueue_InitialFlattenConsumeOne +Description: tests reading and discarding more bytes than it is avaliable +Expected: exception throw +*/ RUNNER_TEST(BinaryQueue_InitialFlattenConsumeOne) { DPL::BinaryQueue queue; @@ -103,6 +143,11 @@ RUNNER_TEST(BinaryQueue_InitialFlattenConsumeOne) RUNNER_FAIL; } +/* +Name: BinaryQueue_InitialFlattenOne +Description: tests reading more bytes than it is avaliable +Expected: exception throw +*/ RUNNER_TEST(BinaryQueue_InitialFlattenOne) { DPL::BinaryQueue queue; @@ -120,6 +165,11 @@ RUNNER_TEST(BinaryQueue_InitialFlattenOne) RUNNER_FAIL; } +/* +Name: BinaryQueue_ZeroCopyFrom +Description: tests coping content of empty queue to another (AppendCopyFrom) +Expected: source queue should be empty +*/ RUNNER_TEST(BinaryQueue_ZeroCopyFrom) { DPL::BinaryQueue queue; @@ -129,6 +179,11 @@ RUNNER_TEST(BinaryQueue_ZeroCopyFrom) RUNNER_ASSERT(queue.Empty()); } +/* +Name: BinaryQueue_ZeroMoveFrom +Description: tests moving content of empty queue to another +Expected: source queue should be empty +*/ RUNNER_TEST(BinaryQueue_ZeroMoveFrom) { DPL::BinaryQueue queue; @@ -138,6 +193,11 @@ RUNNER_TEST(BinaryQueue_ZeroMoveFrom) RUNNER_ASSERT(queue.Empty()); } +/* +Name: BinaryQueue_ZeroCopyTo +Description: tests moving content of empty queue to another (AppendCopyTo) +Expected: source queue should be empty +*/ RUNNER_TEST(BinaryQueue_ZeroCopyTo) { DPL::BinaryQueue queue; @@ -147,6 +207,11 @@ RUNNER_TEST(BinaryQueue_ZeroCopyTo) RUNNER_ASSERT(queue.Empty()); } +/* +Name: BinaryQueue_InsertSingleCharacters +Description: tests inserting single bytes to queue +Expected: stringified content and size shoudl match expected +*/ RUNNER_TEST(BinaryQueue_InsertSingleCharacters) { DPL::BinaryQueue queue; @@ -160,6 +225,12 @@ RUNNER_TEST(BinaryQueue_InsertSingleCharacters) RUNNER_ASSERT(BinaryQueueToString(queue) == "abcd"); } +/* +Name: BinaryQueue_Consume +Description: tests comsuming portions of 1 or 2 bytes +Expected: stringified content and size should match expected + Bytes should be pope from begin. +*/ RUNNER_TEST(BinaryQueue_Consume) { DPL::BinaryQueue queue; @@ -186,6 +257,11 @@ RUNNER_TEST(BinaryQueue_Consume) RUNNER_ASSERT(BinaryQueueToString(queue) == ""); } +/* +Name: BinaryQueue_Flatten +Description: tests comsuming portions of 1 and more bytes +Expected: stringified content and size should match expected +*/ RUNNER_TEST(BinaryQueue_Flatten) { DPL::BinaryQueue queue; @@ -199,6 +275,12 @@ RUNNER_TEST(BinaryQueue_Flatten) RUNNER_ASSERT(BinaryQueueToString(queue) == "abcdefg"); } +/* +Name: BinaryQueue_FlattenConsume +Description: tests comsuming portions of 1 and more bytes +Expected: stringified content and size should match expected + reading and discarding bytes should affect queue's size and content +*/ RUNNER_TEST(BinaryQueue_FlattenConsume) { DPL::BinaryQueue queue; @@ -215,6 +297,12 @@ RUNNER_TEST(BinaryQueue_FlattenConsume) RUNNER_ASSERT(BinaryQueueToString(queue) == "def"); } +/* +Name: BinaryQueue_AppendCopyFrom +Description: tests creating copy of not empty queue (use of: AppendCopyFrom) +Expected: stringified content and size should match expected + from original queue and it's copy +*/ RUNNER_TEST(BinaryQueue_AppendCopyFrom) { DPL::BinaryQueue queue; @@ -231,6 +319,12 @@ RUNNER_TEST(BinaryQueue_AppendCopyFrom) RUNNER_ASSERT(BinaryQueueToString(copy) == "abcdef"); } +/* +Name: BinaryQueue_AppendCopyTo +Description: tests creating copy of not empty queue (use of: AppendCopyTo) +Expected: stringified content and size should match expected + from original queue and it's copy +*/ RUNNER_TEST(BinaryQueue_AppendCopyTo) { DPL::BinaryQueue queue; @@ -247,6 +341,12 @@ RUNNER_TEST(BinaryQueue_AppendCopyTo) RUNNER_ASSERT(BinaryQueueToString(copy) == "abcdef"); } +/* +Name: BinaryQueue_AppendMoveFrom +Description: tests moving content of not empty queue (use of: AppendMoveFrom) +Expected: stringified content and size should match expected + for new queue. Old queue should be empty after operation +*/ RUNNER_TEST(BinaryQueue_AppendMoveFrom) { DPL::BinaryQueue queue; @@ -263,6 +363,12 @@ RUNNER_TEST(BinaryQueue_AppendMoveFrom) RUNNER_ASSERT(BinaryQueueToString(copy) == "abcdef"); } +/* +Name: BinaryQueue_AppendMoveFrom +Description: tests moving content of not empty queue (use of: AppendMoveTo) +Expected: stringified content and size should match expected + for new queue. Old queue should be empty after operation +*/ RUNNER_TEST(BinaryQueue_AppendMoveTo) { DPL::BinaryQueue queue; @@ -312,6 +418,12 @@ class Visitor : } }; +/* +Name: BinaryQueue_Visitor +Description: tests byte by byte content of queue by use of visitor +Expected: stringified content and size should match expected + Each byte should be at right position +*/ RUNNER_TEST(BinaryQueue_Visitor) { DPL::BinaryQueue queue; @@ -338,6 +450,11 @@ RUNNER_TEST(BinaryQueue_AbstracInputRead) RUNNER_ASSERT(queue.Size() == 0); } +/* +Name: BinaryQueue_AbstracOutputWrite +Description: tests appending one queue to another +Expected: written bytes shoudl affect content and size of queue +*/ RUNNER_TEST(BinaryQueue_AbstracOutputWrite) { DPL::BinaryQueue queue; diff --git a/tests/dpl/core/test_fast_delegate.cpp b/tests/dpl/core/test_fast_delegate.cpp index e502bda..dc9b34a 100644 --- a/tests/dpl/core/test_fast_delegate.cpp +++ b/tests/dpl/core/test_fast_delegate.cpp @@ -145,6 +145,11 @@ class CDerivedClass : } }; +/* +Name: FastDelegate_Test +Description: tests several scenarios of using fast delegates +Expected: function calls succeeded +*/ RUNNER_TEST(FastDelegate_Test) { // Delegates with up to 8 parameters are supported. diff --git a/tests/dpl/core/test_foreach.cpp b/tests/dpl/core/test_foreach.cpp index a5cd399..08d66df 100644 --- a/tests/dpl/core/test_foreach.cpp +++ b/tests/dpl/core/test_foreach.cpp @@ -88,6 +88,11 @@ std::set temporarySet() return set; } +/* +Name: Foreach_std_containers +Description: tests iterating contianers set, list, vector using foreach +Expected: value supplied by foreach matches sequence of integers +*/ RUNNER_TEST(Foreach_std_containers) { std::vector vector; diff --git a/tests/dpl/core/test_log_unhandled_exception.cpp b/tests/dpl/core/test_log_unhandled_exception.cpp index 9c3055c..3299357 100644 --- a/tests/dpl/core/test_log_unhandled_exception.cpp +++ b/tests/dpl/core/test_log_unhandled_exception.cpp @@ -45,6 +45,13 @@ class MySTDException : } }; +/* +Name: Log_Unknown_Exception +Description: tests exceptions catching macros +Expected: unknown exception should be catched + +TODO: workaround abort call +*/ RUNNER_TEST(Log_Unknown_Exception) { UNHANDLED_EXCEPTION_HANDLER_BEGIN @@ -55,6 +62,13 @@ RUNNER_TEST(Log_Unknown_Exception) RUNNER_ASSERT(true); } +/* +Name: Log_DPL_Exception +Description: tests exceptions catching macros +Expected: DPL exception should be catched + +TODO: workaround abort call +*/ RUNNER_TEST(Log_DPL_Exception) { UNHANDLED_EXCEPTION_HANDLER_BEGIN @@ -65,6 +79,13 @@ RUNNER_TEST(Log_DPL_Exception) RUNNER_ASSERT(true); } +/* +Name: Log_STD_Exception +Description: tests exceptions catching macros +Expected: STD exception should be catched + +TODO: workaround abort call +*/ RUNNER_TEST(Log_STD_Exception) { UNHANDLED_EXCEPTION_HANDLER_BEGIN diff --git a/tests/dpl/core/test_once.cpp b/tests/dpl/core/test_once.cpp index 3fcc2be..436aea4 100644 --- a/tests/dpl/core/test_once.cpp +++ b/tests/dpl/core/test_once.cpp @@ -78,6 +78,11 @@ class MyThread : DPL::Atomic *m_atom; }; +/* +Name: Once_MultiThreadCall +Description: tests once call wrapper for use by multiple threads +Expected: function should be called just once from one of running threads +*/ RUNNER_TEST(Once_MultiThreadCall) { const size_t NUM_THREADS = 20; diff --git a/tests/dpl/core/test_scoped_array.cpp b/tests/dpl/core/test_scoped_array.cpp index 58b0603..f2a3b4b 100644 --- a/tests/dpl/core/test_scoped_array.cpp +++ b/tests/dpl/core/test_scoped_array.cpp @@ -24,6 +24,11 @@ RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: ScopedArray_Zero +Description: tests emptiness of empty scoped array +Expected: array should be empty +*/ RUNNER_TEST(ScopedArray_Zero) { DPL::ScopedArray array; @@ -32,6 +37,11 @@ RUNNER_TEST(ScopedArray_Zero) RUNNER_ASSERT(!!!array); } +/* +Name: ScopedArray_NonZero +Description: tests emptiness of not empty scoped array +Expected: array should be not empty +*/ RUNNER_TEST(ScopedArray_NonZero) { DPL::ScopedArray array(new char[7]); @@ -40,6 +50,11 @@ RUNNER_TEST(ScopedArray_NonZero) RUNNER_ASSERT(!!array); } +/* +Name: ScopedArray_Reset +Description: tests reseting content of array +Expected: array should be empty after reset +*/ RUNNER_TEST(ScopedArray_Reset) { DPL::ScopedArray array(new char[7]); @@ -51,6 +66,11 @@ RUNNER_TEST(ScopedArray_Reset) RUNNER_ASSERT(array); } +/* +Name: ScopedArray_ArrayOperator +Description: tests accessing elements of array +Expected: returned values should be equal to those which were set +*/ RUNNER_TEST(ScopedArray_ArrayOperator) { DPL::ScopedArray array(new char[7]); diff --git a/tests/dpl/core/test_scoped_fclose.cpp b/tests/dpl/core/test_scoped_fclose.cpp index 3450c71..7667a9e 100644 --- a/tests/dpl/core/test_scoped_fclose.cpp +++ b/tests/dpl/core/test_scoped_fclose.cpp @@ -39,6 +39,11 @@ FILE* MakeTmp() } } //anonymous namespace +/* +Name: ScopedFClose_Zero +Description: tests if operator ! works correct for closed file +Expected: file should be closed +*/ RUNNER_TEST(ScopedFClose_Zero) { DPL::ScopedFClose file; @@ -47,6 +52,11 @@ RUNNER_TEST(ScopedFClose_Zero) RUNNER_ASSERT(!!!file); } +/* +Name: ScopedArray_NonZero +Description: tests if operator ! works correct for open file +Expected: file should be open +*/ RUNNER_TEST(ScopedFClose_NonZero) { DPL::ScopedFClose file(MakeTmp()); @@ -55,6 +65,11 @@ RUNNER_TEST(ScopedFClose_NonZero) RUNNER_ASSERT(!!file); } +/* +Name: ScopedFClose_Reset +Description: tests reseting of scoped file +Expected: file should be closed after reset +*/ RUNNER_TEST(ScopedFClose_Reset) { DPL::ScopedFClose file(MakeTmp()); diff --git a/tests/dpl/core/test_scoped_free.cpp b/tests/dpl/core/test_scoped_free.cpp index bc41a5a..25bd6d6 100644 --- a/tests/dpl/core/test_scoped_free.cpp +++ b/tests/dpl/core/test_scoped_free.cpp @@ -25,6 +25,11 @@ RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: ScopedFree_Zero +Description: Checks emptiness of not set scoped free +Expected: resource should be freed +*/ RUNNER_TEST(ScopedFree_Zero) { DPL::ScopedFree free; @@ -33,6 +38,11 @@ RUNNER_TEST(ScopedFree_Zero) RUNNER_ASSERT(!!!free); } +/* +Name: ScopedFree_NonZero +Description: Checks emptiness of set scoped free +Expected: resource should not be reported as freed +*/ RUNNER_TEST(ScopedFree_NonZero) { DPL::ScopedFree free(malloc(7)); @@ -41,6 +51,11 @@ RUNNER_TEST(ScopedFree_NonZero) RUNNER_ASSERT(!!free); } +/* +Name: ScopedFree_Reset +Description: Checks reseting scoped free +Expected: resource should be freed after reset +*/ RUNNER_TEST(ScopedFree_Reset) { DPL::ScopedFree free(malloc(7)); diff --git a/tests/dpl/core/test_scoped_ptr.cpp b/tests/dpl/core/test_scoped_ptr.cpp index f3a7237..af17bac 100644 --- a/tests/dpl/core/test_scoped_ptr.cpp +++ b/tests/dpl/core/test_scoped_ptr.cpp @@ -24,6 +24,11 @@ RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: ScopedPtr_Zero +Description: Checks if operator! works +Expected: resource should be not set +*/ RUNNER_TEST(ScopedPtr_Zero) { DPL::ScopedPtr ptr; @@ -32,6 +37,11 @@ RUNNER_TEST(ScopedPtr_Zero) RUNNER_ASSERT(!!!ptr); } +/* +Name: ScopedPtr_NonZero +Description: Checks if operator! works +Expected: resource should be set +*/ RUNNER_TEST(ScopedPtr_NonZero) { DPL::ScopedPtr ptr(new char(7)); @@ -40,6 +50,11 @@ RUNNER_TEST(ScopedPtr_NonZero) RUNNER_ASSERT(!!ptr); } +/* +Name: ScopedPtr_Reset +Description: Checks reseting scoped ptr +Expected: resource should be not set after reset +*/ RUNNER_TEST(ScopedPtr_Reset) { DPL::ScopedPtr ptr(new char(7)); @@ -51,6 +66,11 @@ RUNNER_TEST(ScopedPtr_Reset) RUNNER_ASSERT(ptr); } +/* +Name: ScopedPtr_Operators +Description: Checks access operator +Expected: address of resource should be same as this, received from Get() method +*/ RUNNER_TEST(ScopedPtr_Operators) { DPL::ScopedPtr ptr(new char(7)); diff --git a/tests/dpl/core/test_semaphore.cpp b/tests/dpl/core/test_semaphore.cpp index 3d689d1..c93b365 100644 --- a/tests/dpl/core/test_semaphore.cpp +++ b/tests/dpl/core/test_semaphore.cpp @@ -63,6 +63,11 @@ class SemaphoreThread : } }; +/* +Name: Semaphore_NamedIncrementDecrement +Description: Checks if semaphore are working +Expected: value should not change after all +*/ RUNNER_TEST(Semaphore_NamedIncrementDecrement) { std::string semaphoreName = diff --git a/tests/dpl/core/test_serialization.cpp b/tests/dpl/core/test_serialization.cpp index b5bc99f..202589b 100644 --- a/tests/dpl/core/test_serialization.cpp +++ b/tests/dpl/core/test_serialization.cpp @@ -99,6 +99,12 @@ class TestClass : public DPL::ISerializable std::vector c; }; +/* +Name: Serialize_primitives +Description: Tests serialization of primitives types +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_primitives) { int a = 1; @@ -119,6 +125,12 @@ RUNNER_TEST(Serialize_primitives) RUNNER_ASSERT(test_unsigned == c); } +/* +Name: Serialize_primitive_pointers +Description: Tests serialization of primitives pointer types +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_primitive_pointers) { int a = 1; @@ -142,6 +154,12 @@ RUNNER_TEST(Serialize_primitive_pointers) delete test_unsigned; } +/* +Name: Serialize_strings +Description: Tests serialization of strings +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_strings) { std::string str1 = "ALA MA KOTA"; @@ -157,6 +175,12 @@ RUNNER_TEST(Serialize_strings) RUNNER_ASSERT(test_str2 == str2); } +/* +Name: Serialize_string_pointers +Description: Tests serialization of string pointers +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_string_pointers) { std::string str1 = "ALA MA KOTA"; @@ -174,6 +198,12 @@ RUNNER_TEST(Serialize_string_pointers) delete test_str2; } +/* +Name: Serialize_containers +Description: Tests serialization of containers +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_containers) { std::vector vec; @@ -213,6 +243,12 @@ RUNNER_TEST(Serialize_containers) test_map.at(-78) == map.at(-78)); } +/* +Name: Serialize_objects +Description: Tests serialization of DPL::ISerializable derived objects +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_objects) { TestClass a(123, "ASDGHUADB\n\n5679b^^()*", "TEST_STRING"), @@ -227,6 +263,12 @@ RUNNER_TEST(Serialize_objects) RUNNER_ASSERT(test_b == b); } +/* +Name: Serialize_all +Description: Tests serialization of compound objects +Expected: serialized value after deserialization + should be equal to deserialied value +*/ RUNNER_TEST(Serialize_all) { std::map > map; diff --git a/tests/dpl/core/test_shared_ptr.cpp b/tests/dpl/core/test_shared_ptr.cpp index 541a333..8e59075 100644 --- a/tests/dpl/core/test_shared_ptr.cpp +++ b/tests/dpl/core/test_shared_ptr.cpp @@ -24,6 +24,11 @@ RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: SharedPtr_Zero +Description: Tests behaviour of null shared pointer +Expected: pointer should imitate null pointer +*/ RUNNER_TEST(SharedPtr_Zero) { DPL::SharedPtr ptr; @@ -33,6 +38,11 @@ RUNNER_TEST(SharedPtr_Zero) RUNNER_ASSERT(ptr == DPL::SharedPtr()); } +/* +Name: SharedPtr_NonZero +Description: Tests behaviour of not null shared pointer +Expected: pointer should imitate null pointer +*/ RUNNER_TEST(SharedPtr_NonZero) { DPL::SharedPtr ptr(new char(7)); @@ -42,6 +52,11 @@ RUNNER_TEST(SharedPtr_NonZero) RUNNER_ASSERT(ptr != DPL::SharedPtr()); } +/* +Name: SharedPtr_Copy +Description: Tests equality of shared pointer pointing same resource +Expected: pointers should imitate primitive pointer bahaviour +*/ RUNNER_TEST(SharedPtr_Copy) { DPL::SharedPtr ptr1(new char(7)); @@ -54,6 +69,11 @@ RUNNER_TEST(SharedPtr_Copy) RUNNER_ASSERT(ptr1 == ptr2); } +/* +Name: SharedPtr_Reset +Description: Tests reseting shared pointer +Expected: pointers should imitate primitive pointer bahaviour after reset +*/ RUNNER_TEST(SharedPtr_Reset) { DPL::SharedPtr ptr(new char(7)); @@ -65,6 +85,12 @@ RUNNER_TEST(SharedPtr_Reset) RUNNER_ASSERT(ptr); } +/* +Name: SharedPtr_RefCounting +Description: Tests use count od shared pointer +Expected: counters should be equal for equal pointers + Count number should match expected +*/ RUNNER_TEST(SharedPtr_RefCounting) { DPL::SharedPtr ptr1(new char(7)); @@ -77,6 +103,11 @@ RUNNER_TEST(SharedPtr_RefCounting) RUNNER_ASSERT(ptr1.GetUseCount() == 2); } +/* +Name: SharedPtr_Operators +Description: Tests use of operator* +Expected: pointers should imitate primitive pointer bahaviour +*/ RUNNER_TEST(SharedPtr_Operators) { DPL::SharedPtr ptr(new char(7)); diff --git a/tests/dpl/core/test_string.cpp b/tests/dpl/core/test_string.cpp index 25ede33..dd2bd8a 100644 --- a/tests/dpl/core/test_string.cpp +++ b/tests/dpl/core/test_string.cpp @@ -181,6 +181,11 @@ WgAAAFsAAABcAAAAXQAAAF4AAABfAAAAYAAAAGEAAABiAAAAYwAAAGQAAABlAAAAZgAAAGcAAABo\ AAAAaQAAAGoAAABrAAAAbAAAAG0AAABuAAAAbwAAAHAAAABxAAAAcgAAAHMAAAB0AAAAdQAAAHYA\ AAB3AAAAeAAAAHkAAAB6AAAAewAAAHwAAAB9AAAAfgAAAAAAAAA="; +/* +Name: String_ConverterFromASCII +Description: tests construction of string from ascii data +Expected: data stored in buffer should match expected +*/ RUNNER_TEST(String_ConverterFromASCII) { char* inStr = NULL; @@ -201,6 +206,11 @@ RUNNER_TEST(String_ConverterFromASCII) free(inStr); } +/* +Name: String_ConverterFromUTF8 +Description: tests construction of string from UTF-8 data +Expected: data stored in buffer should match expected +*/ RUNNER_TEST(String_ConverterFromUTF8) { char* inStr = NULL; @@ -220,6 +230,11 @@ RUNNER_TEST(String_ConverterFromUTF8) free(inStr); } +/* +Name: String_ConverterFromUTF32 +Description: tests construction of string from UTF-32 data +Expected: data stored in buffer should match expected +*/ RUNNER_TEST(String_ConverterFromUTF32) { wchar_t* inStr = NULL; @@ -273,6 +288,11 @@ void String_TokenizeReal(const DelimiterType& delimiter) RUNNER_ASSERT(expectedTokens == tokens); } +/* +Name: String_Tokenize +Description: tests of string splitting +Expected: returned substring should match expected values +*/ RUNNER_TEST(String_Tokenize) { String_TokenizeReal(L"#."); @@ -354,6 +374,11 @@ void TestOutStreams( RUNNER_ASSERT(ostream.str() == argumentResultString); } +/* +Name: String_Streams +Description: tests of input/output stream +Expected: returned substrign should match expected values +*/ RUNNER_TEST(String_Streams) { TestInStreams >("1 1.1 1.1 test", "test"); @@ -364,6 +389,11 @@ RUNNER_TEST(String_Streams) TestOutStreams(L"test", L"11.11.1test"); } +/* +Name: String_CompareCaseSensitive +Description: tests case sensitive comparision +Expected: strings should be equal +*/ RUNNER_TEST(String_CompareCaseSensitive) { RUNNER_ASSERT( @@ -372,6 +402,11 @@ RUNNER_TEST(String_CompareCaseSensitive) DPL::FromUTF32String(L"Ala Makota ma żołądkówkę")) == 0); } +/* +Name: String_CompareCaseInsensitive +Description: tests case insensitive comparision +Expected: strings should be equal +*/ RUNNER_TEST(String_CompareCaseInsensitive) { RUNNER_ASSERT( diff --git a/tests/dpl/core/test_thread.cpp b/tests/dpl/core/test_thread.cpp index da9aa99..5db0dc1 100644 --- a/tests/dpl/core/test_thread.cpp +++ b/tests/dpl/core/test_thread.cpp @@ -69,6 +69,11 @@ class FooThread : } }; +/* +Name: Thread_ThreadLocalVariable_FooDeletion +Description: tests local thread variable pattern +Expected: local thread variables should not be affected by other threads +*/ RUNNER_TEST(Thread_ThreadLocalVariable_FooDeletion) { static TlsFoo staticFooForMain; diff --git a/tests/dpl/core/test_type_list.cpp b/tests/dpl/core/test_type_list.cpp index 98167f3..b3e6285 100644 --- a/tests/dpl/core/test_type_list.cpp +++ b/tests/dpl/core/test_type_list.cpp @@ -25,6 +25,11 @@ RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: TypeList_TypeCount +Description: tests size of typelist idiom +Expected: size should match +*/ RUNNER_TEST(TypeList_TypeCount) { typedef DPL::TypeListDecl::Type TestTypeList1; diff --git a/tests/dpl/core/test_zip_input.cpp b/tests/dpl/core/test_zip_input.cpp index 5e5b9b4..c62accb 100644 --- a/tests/dpl/core/test_zip_input.cpp +++ b/tests/dpl/core/test_zip_input.cpp @@ -37,6 +37,11 @@ const char* ARCHIVED_FILE = "sample.txt"; RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: ZipInput_OpenFailed +Description: tests opening non existing file +Expected: exception throw +*/ RUNNER_TEST(ZipInput_OpenFailed) { bool opened = true; @@ -54,6 +59,11 @@ RUNNER_TEST(ZipInput_OpenFailed) RUNNER_ASSERT(opened == false); } +/* +Name: ZipInput_OpenFile +Description: tests opening existing file +Expected: zip stats should mkatch expected +*/ RUNNER_TEST(ZipInput_OpenFile) { DPL::ZipInput zip(PATH_ARCHIVE); @@ -71,6 +81,11 @@ RUNNER_TEST(ZipInput_OpenFile) } } +/* +Name: ZipInput_UnzipSingleFile +Description: tests opening existing file and unzipping single file +Expected: right content +*/ RUNNER_TEST(ZipInput_UnzipSingleFile) { DPL::ZipInput zip(PATH_ARCHIVE); diff --git a/tests/dpl/db/test_orm.cpp b/tests/dpl/db/test_orm.cpp index 3e55a20..500f43d 100644 --- a/tests/dpl/db/test_orm.cpp +++ b/tests/dpl/db/test_orm.cpp @@ -93,6 +93,11 @@ std::list makeList(const T& a, const T& b) RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: ORM_SelectSingleValue +Description: tests quering single value of single row from database +Expected: Values should match those which were prepared +*/ RUNNER_TEST(ORM_SelectSingleValue) { SmartAttach interface; @@ -181,6 +186,11 @@ RUNNER_TEST(ORM_SelectSingleValue) } } +/* +Name: ORM_SelectSingleRow +Description: tests quering single row from database +Expected: Values should match those which were prepared +*/ RUNNER_TEST(ORM_SelectSingleRow) { SmartAttach interface; @@ -213,6 +223,11 @@ RUNNER_TEST(ORM_SelectSingleRow) } } +/* +Name: ORM_SelectRowList +Description: tests quering multiple row from database +Expected: Values should match those which were prepared +*/ RUNNER_TEST(ORM_SelectRowList) { SmartAttach interface; @@ -270,6 +285,11 @@ RUNNER_TEST(ORM_SelectRowList) } } +/* +Name: ORM_SelectValueList +Description: tests quering single column from multiple row from database +Expected: Values should match those which were prepared +*/ RUNNER_TEST(ORM_SelectValueList) { SmartAttach interface; @@ -334,6 +354,11 @@ RUNNER_TEST(ORM_SelectValueList) } } +/* +Name: ORM_MultipleCalls +Description: tests sequnece of different queries +Expected: Values should match those which were prepared +*/ RUNNER_TEST(ORM_MultipleCalls) { for (int j = 0; j < TEST_REPETITION; j++) { @@ -355,6 +380,11 @@ RUNNER_TEST(ORM_MultipleCalls) } } +/* +Name: ORM_Insert +Description: tests insering rows into database +Expected: Values should be inserted +*/ RUNNER_TEST(ORM_Insert) { SmartAttach interface; @@ -445,6 +475,11 @@ RUNNER_TEST(ORM_Insert) } } +/* +Name: ORM_MultipleBindInsert +Description: repeats ORM_Insert test several times +Expected: Values should be inserted +*/ RUNNER_TEST(ORM_MultipleBindInsert) { for (int i = 0; i < TEST_REPETITION; i++) { @@ -452,6 +487,11 @@ RUNNER_TEST(ORM_MultipleBindInsert) } } +/* +Name: ORM_Delete +Description: tests deleting rows from database +Expected: deleted rows should not exist +*/ RUNNER_TEST(ORM_Delete) { SmartAttach interface; @@ -565,6 +605,11 @@ RUNNER_TEST(ORM_Delete) } } +/* +Name: ORM_MultipleBindDelete +Description: repeats ORM_Delete test several times +Expected: Values should be deleted +*/ RUNNER_TEST(ORM_MultipleBindDelete) { for (int i = 0; i < TEST_REPETITION; i++) { @@ -572,6 +617,11 @@ RUNNER_TEST(ORM_MultipleBindDelete) } } +/* +Name: ORM_MultipleBindWhere +Description: tests if multiple bind of same query obejct works +Expected: Each bind and execution of query should be correct +*/ RUNNER_TEST(ORM_MultipleBindWhere) { SmartAttach interface; @@ -654,6 +704,11 @@ RUNNER_TEST(ORM_MultipleBindWhere) } } +/* +Name: ORM_Update +Description: tests rows update in database +Expected: Successful update +*/ RUNNER_TEST(ORM_Update) { SmartAttach interface; @@ -775,6 +830,11 @@ RUNNER_TEST(ORM_Update) } } +/* +Name: ORM_MultipleBindUpdate +Description: repeats ORM_Update severl times +Expected: Successful update +*/ RUNNER_TEST(ORM_MultipleBindUpdate) { for (int i = 0; i < TEST_REPETITION; i++) { @@ -782,12 +842,22 @@ RUNNER_TEST(ORM_MultipleBindUpdate) } } +/* +Name: ORM_transactions +Description: checks creation of transation object +Expected: Successful creation of transaction object +*/ RUNNER_TEST(ORM_transactions) { SmartAttach interface; DPL::DB::ORM::dpl_orm_test::ScopedTransaction transaction(interface.get()); } +/* +Name: ORM_MultiAttach +Description: checks correct behaviou in case of multiple tries to attach to database +Expected: Methods attaching/dettaching should be prepared for multiple calling +*/ RUNNER_TEST(ORM_MultiAttach) { SmartAttach interface(false); @@ -807,6 +877,11 @@ RUNNER_TEST(ORM_MultiAttach) !interface.get()->IsAttached(), "Is attached, but shouldn't be."); } +/* +Name: ORM_Join +Description: tests ORM's join operation +Expected: values should insist correct join operation +*/ RUNNER_TEST(ORM_Join) { SmartAttach interface; diff --git a/tests/dpl/db/test_sql_connection.cpp b/tests/dpl/db/test_sql_connection.cpp index 0cee018..0f37b2d 100644 --- a/tests/dpl/db/test_sql_connection.cpp +++ b/tests/dpl/db/test_sql_connection.cpp @@ -139,6 +139,11 @@ void MassiveReadWriteTest(AbstractSynchronizationObjectGenerator *generator) connection.ExecCommand("DROP TABLE test;"); } +/* +Name: SqlConnection_MassiveReadWrite_NaiveSynchronization +Description: tests massive multiple quiries from many threads +Expected: no ORM/db failures +*/ RUNNER_TEST(SqlConnection_MassiveReadWrite_NaiveSynchronization) { srand(time(NULL)); @@ -147,6 +152,11 @@ RUNNER_TEST(SqlConnection_MassiveReadWrite_NaiveSynchronization) MassiveReadWriteTest(&m_generator); } +/* +Name: SqlConnection_Not_Connected_Lucene +Description: tests connection to not existing database with Lucene option +Expected: exception throw +*/ RUNNER_TEST(SqlConnection_Not_Connected_Lucene) { Try { @@ -167,6 +177,11 @@ RUNNER_TEST(SqlConnection_Not_Connected_Lucene) } } +/* +Name: SqlConnection_Not_Connected +Description: tests connection to not existing database without Lucene option +Expected: exception throw +*/ RUNNER_TEST(SqlConnection_Not_Connected) { Try { @@ -185,6 +200,11 @@ RUNNER_TEST(SqlConnection_Not_Connected) } } +/* +Name: SqlConnection_Null_Query +Description: tests resistance to passing NULL as query in ExecCommand +Expected: exception throw +*/ RUNNER_TEST(SqlConnection_Null_Query) { DPL::DB::SqlConnection connection(PATH_DB, @@ -204,6 +224,11 @@ RUNNER_TEST(SqlConnection_Null_Query) } } +/* +Name: SqlConnection_Bad_Query +Description: tests resistance to passing trash as query in ExecCommand +Expected: exception throw +*/ RUNNER_TEST(SqlConnection_Bad_Query) { DPL::DB::SqlConnection connection(PATH_DB, diff --git a/tests/dpl/dbus/test_cases.cpp b/tests/dpl/dbus/test_cases.cpp index 1e5c608..0d855ef 100644 --- a/tests/dpl/dbus/test_cases.cpp +++ b/tests/dpl/dbus/test_cases.cpp @@ -61,6 +61,11 @@ const int DEFAULT_TIMEOUT = 2; // in seconds RUNNER_TEST_GROUP_INIT(DPL) +/* +Name: AcquireSessionBus +Description: tests acquiring session bus +Expected: no exceptions +*/ RUNNER_TEST(AcquireSessionBus) { try { @@ -70,6 +75,11 @@ RUNNER_TEST(AcquireSessionBus) } } +/* +Name: AcquireSystemBus +Description: tests acquiring system bus +Expected: no exceptions +*/ RUNNER_TEST(AcquireSystemBus) { try { @@ -79,6 +89,11 @@ RUNNER_TEST(AcquireSystemBus) } } +/* +Name: ParseNodeInfo +Description: creates dbus interface from xml string +Expected: interface should be created correctly +*/ RUNNER_TEST(ParseNodeInfo) { try { @@ -93,6 +108,11 @@ RUNNER_TEST(ParseNodeInfo) } } +/* +Name: InvokeRemoteMethod +Description: performs procedure call via dbus +Expected: call should return not empty id +*/ RUNNER_TEST(InvokeRemoteMethod) { try { @@ -127,6 +147,11 @@ class RegisterServiceListener : } }; +/* +Name: RegisterService +Description: tests event listener for AcquiredEvent in context of dbus +Expected: event should be received +*/ DBUS_TEST(RegisterService) { try { diff --git a/tests/dpl/event/test_controller.cpp b/tests/dpl/event/test_controller.cpp index aa07167..8f0a630 100644 --- a/tests/dpl/event/test_controller.cpp +++ b/tests/dpl/event/test_controller.cpp @@ -145,6 +145,11 @@ class StrangeController : } }; +/* +Name: Controller_InitSimple +Description: tests initialization of simple int controller +Expected: no exceptions +*/ RUNNER_TEST(Controller_InitSimple) { IntController controller; @@ -152,12 +157,22 @@ RUNNER_TEST(Controller_InitSimple) RUNNER_ASSERT(controller.Value() == -1); } +/* +Name: Controller_InitStrange +Description: tests initialization of struct controller +Expected: no exceptions +*/ RUNNER_TEST(Controller_InitStrange) { StrangeController controller; controller.Touch(); } +/* +Name: Controller_PostEventToThread +Description: tests post events to other thread +Expected: thread id gathered in event handling method should match id of created thread +*/ RUNNER_TEST(Controller_PostEventToThread) { ThreadController controller; @@ -179,6 +194,11 @@ RUNNER_TEST(Controller_PostEventToThread) RUNNER_ASSERT(controller.Value() == &thread); } +/* +Name: Controller_PostTimedEventToThread +Description: tests post events to other thread with time delay +Expected: thread id gathered in event handling method should match id of created thread +*/ RUNNER_TEST(Controller_PostTimedEventToThread) { ThreadController controller; @@ -236,6 +256,12 @@ class TouchInThreadController : } }; +/* +Name: Controller_TouchInThread +Description: tests ability to touch (initizilize / set destination thread) in creatd thread + other than thread were controlelr object was created +Expected: thread id gathered in event handling method should match id of created thread +*/ RUNNER_TEST(Controller_TouchInThread) { TouchInThreadController controller; @@ -259,6 +285,11 @@ RUNNER_TEST(Controller_TouchInThread) RUNNER_ASSERT(touchedThread == &thread); } +/* +Name: Controller_SynchronizedEvent +Description: tests ability to post synchronized events to ther thread +Expected: correct value should be saved when event was handled +*/ RUNNER_TEST(Controller_SynchronizedEvent) { IntController controller; @@ -351,6 +382,14 @@ class TestController : } }; +/* +Name: Controllers_MultipleEvents +Description: tests controller coooperation. + This runs many controllers in many threads. Each controller sends + to other randomly chosen controller events. +Expected: Test is supposed to be ended when all limits of sent event will be reach + -> all scheduled event will be sent and received. +*/ RUNNER_TEST(Controllers_MultipleEvents) { srand(time(NULL) ); diff --git a/tests/dpl/event/test_event_support.cpp b/tests/dpl/event/test_event_support.cpp index 63c1631..e900e9c 100644 --- a/tests/dpl/event/test_event_support.cpp +++ b/tests/dpl/event/test_event_support.cpp @@ -82,6 +82,12 @@ class QuitController : } }; +/* +Name: EventSupport_DestroyBeforeProcessing +Description: tests if remoign listener is full successfull +Expected: dummy var should be affected by explicit call of ZeroDummyVar(), + but no by emitting event after removing listener +*/ RUNNER_TEST(EventSupport_DestroyBeforeProcessing) { QuitController quitter; @@ -120,6 +126,12 @@ class DelegateTestSupport : } }; +/* +Name: EventSupport_BindDelegate +Description: tests if event support derived class successfully propagates + event to registered listener +Expected: value of event should be passed to listener +*/ RUNNER_TEST(EventSupport_BindDelegate) { g_delegateTest = 0; diff --git a/tests/dpl/event/test_ic_delegate.cpp b/tests/dpl/event/test_ic_delegate.cpp index 402c090..77856f4 100644 --- a/tests/dpl/event/test_ic_delegate.cpp +++ b/tests/dpl/event/test_ic_delegate.cpp @@ -193,6 +193,11 @@ class TestContextFreeClass : ICTestController* m_controller; }; +/* +Name: ICDelegate_0 +Description: checks if delegetes are correctly called +Expected: delegates should be called from right context +*/ RUNNER_TEST(ICDelegate_0) { DPL::Thread thread; @@ -219,6 +224,11 @@ RUNNER_TEST(ICDelegate_0) result.TestEventsPassed(); } +/* +Name: ICDelegate_1 +Description: checks if delegetes are correctly called +Expected: delegates should be called from right context +*/ RUNNER_TEST(ICDelegate_1) { DPL::Thread thread; @@ -433,6 +443,11 @@ class TestRunnerInThread : public DPL::Thread int m_tests; }; +/* +Name: ICDelegate_2 +Description: checks if delegetes are correctly called +Expected: delegates should be called from right context +*/ RUNNER_TEST(ICDelegate_2) { LogDebug("Creating test threads"); @@ -557,6 +572,11 @@ class ReuseTestContextFreeClass : int m_reuseCount; }; +/* +Name: ICDelegate_3 +Description: checks if delegetes are correctly called +Expected: delegates should be called from right context +*/ RUNNER_TEST(ICDelegate_3) { DPL::Thread thread; diff --git a/tests/dpl/event/test_property.cpp b/tests/dpl/event/test_property.cpp index d3df904..d72d02e 100644 --- a/tests/dpl/event/test_property.cpp +++ b/tests/dpl/event/test_property.cpp @@ -92,6 +92,11 @@ void OnNameChanged(const DPL::Event::PropertyEvent &event) g_caption = event.value; } +/* +Name: Model_Test +Description: tests accessing and changing models properties +Expected: listener should get changed value +*/ RUNNER_TEST(Model_Test) { MyModel model; diff --git a/tests/dpl/utils/bash_utils.cpp b/tests/dpl/utils/bash_utils.cpp index c6a711c..7dac1fc 100644 --- a/tests/dpl/utils/bash_utils.cpp +++ b/tests/dpl/utils/bash_utils.cpp @@ -26,6 +26,11 @@ using namespace BashUtils; RUNNER_TEST_GROUP_INIT(DPL_BASH_UTILS) +/* +Name: Bash_Utils_escape_arg +Description:tests ecaping bash special characters for command arguments +Expected: matching string +*/ RUNNER_TEST(Bash_Utils_escape_arg) { RUNNER_ASSERT_MSG(escape_arg(std::string( diff --git a/tests/dpl/utils/widget_version.cpp b/tests/dpl/utils/widget_version.cpp index 0d10117..f00c715 100644 --- a/tests/dpl/utils/widget_version.cpp +++ b/tests/dpl/utils/widget_version.cpp @@ -24,6 +24,11 @@ RUNNER_TEST_GROUP_INIT(DPL_WIDGET_VERSION) +/* +Name: WidgetVersion_M2_O0 +Description: tests correct parsing of version widget in format: [major].[minor] +Expected: major and minor parts matches expected values +*/ RUNNER_TEST(WidgetVersion_M2_O0) { DPL::String raw(L"1.2"); @@ -37,6 +42,11 @@ RUNNER_TEST(WidgetVersion_M2_O0) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M2_O0_nonwac_1 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_1) { DPL::String raw(L"a1.2"); @@ -46,6 +56,11 @@ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_1) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M2_O0_nonwac_2 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_2) { DPL::String raw(L"1.2a"); @@ -55,6 +70,11 @@ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_2) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M2_O0_nonwac_3 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_3) { DPL::String raw(L"aaa1.2bbb"); @@ -64,6 +84,11 @@ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_3) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M2_O0_nonwac_4 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_4) { DPL::String raw(L"1a.a2"); @@ -73,6 +98,12 @@ RUNNER_TEST(WidgetVersion_M2_O0_nonwac_4) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M2_O0_long +Description: tests correct parsing of version widget in format: [major].[minor] + for huge number +Expected: major and minor parts matches expected values +*/ RUNNER_TEST(WidgetVersion_M2_O0_long) { DPL::String raw( @@ -89,6 +120,12 @@ RUNNER_TEST(WidgetVersion_M2_O0_long) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O0 +Description: tests correct wac version number +Expected: major and minor and micro parts matches expected values. + Version should be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O0) { DPL::String raw(L"1.2.3"); @@ -102,6 +139,11 @@ RUNNER_TEST(WidgetVersion_M3_O0) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O0_nonwac_1 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_1) { DPL::String raw(L"a1a.2.3"); @@ -111,6 +153,11 @@ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_1) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O0_nonwac_2 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_2) { DPL::String raw(L"1.b2.3"); @@ -120,6 +167,11 @@ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_2) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O0_nonwac_3 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_3) { DPL::String raw(L"1.2.3c"); @@ -129,6 +181,11 @@ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_3) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O0_nonwac_4 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_4) { DPL::String raw(L"1.2.3a"); @@ -138,6 +195,12 @@ RUNNER_TEST(WidgetVersion_M3_O0_nonwac_4) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O1_1 +Description: tests correct wac version number with optional part +Expected: major and minor and micro and optional parts matches expected values. + Version should be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O1_1) { DPL::String raw(L"1.2.3 test111"); @@ -151,6 +214,12 @@ RUNNER_TEST(WidgetVersion_M3_O1_1) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O1_1 +Description: tests correct wac version number with numeric optional part +Expected: major and minor and micro and optional parts matches expected values. + Version should be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O1_2) { DPL::String raw(L"1.2.3 111"); @@ -164,6 +233,12 @@ RUNNER_TEST(WidgetVersion_M3_O1_2) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M3_O1_3 +Description: tests if version is recognized as wac version number + when trailer spaces exists +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M3_O1_3) { DPL::String raw(L"1.2.3 "); @@ -173,6 +248,12 @@ RUNNER_TEST(WidgetVersion_M3_O1_3) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_M2_O1_1 +Description: tests if version is recognized as wac version number + when optional part +Expected: version should be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_M2_O1_1) { DPL::String raw(L"1.2 t"); @@ -186,6 +267,11 @@ RUNNER_TEST(WidgetVersion_M2_O1_1) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Strange_0 +Description: tests if version is recognized as wac version number +Expected: version should be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_Strange_0) { DPL::String raw(L"1"); @@ -195,6 +281,11 @@ RUNNER_TEST(WidgetVersion_Strange_0) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Strange_1 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_Strange_1) { DPL::String raw(L".1"); @@ -204,6 +295,11 @@ RUNNER_TEST(WidgetVersion_Strange_1) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Strange_2 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_Strange_2) { DPL::String raw(L"..1"); @@ -213,6 +309,11 @@ RUNNER_TEST(WidgetVersion_Strange_2) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Strange_3 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_Strange_3) { DPL::String raw(L"...1"); @@ -222,6 +323,11 @@ RUNNER_TEST(WidgetVersion_Strange_3) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Strange_4 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_Strange_4) { DPL::String raw(L"qwerty"); @@ -231,6 +337,11 @@ RUNNER_TEST(WidgetVersion_Strange_4) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Strange_5 +Description: tests if version is recognized as wac version number +Expected: version should not be recognized as wac compatible +*/ RUNNER_TEST(WidgetVersion_Strange_5) { DPL::String raw(L"!@#$%^&*()_+ ^&%^*&%$^*&%*()& JHKJLHKJLH 685685687"); @@ -240,27 +351,52 @@ RUNNER_TEST(WidgetVersion_Strange_5) RUNNER_ASSERT(version.Raw() == raw); } +/* +Name: WidgetVersion_Compare_0 +Description: tests version comparision in format [major].[minor] +Expected: compare should work as expected +*/ RUNNER_TEST(WidgetVersion_Compare_0) { RUNNER_ASSERT(WidgetVersion(L"1.1") < WidgetVersion(L"1.2")); } +/* +Name: WidgetVersion_Compare_1 +Description: tests version comparision in format [major].[minor] +Expected: compare should work as expected +*/ RUNNER_TEST(WidgetVersion_Compare_1) { RUNNER_ASSERT(WidgetVersion(L"01.001") < WidgetVersion(L"0001.002")); } +/* +Name: WidgetVersion_Compare_2 +Description: tests version equality in format [major].[minor] +Expected: versions should be equal +*/ RUNNER_TEST(WidgetVersion_Compare_2) { RUNNER_ASSERT(WidgetVersion(L"0.1") == WidgetVersion(L"00.1")); } +/* +Name: WidgetVersion_Compare_3 +Description: tests version comparision in format [major].[minor] [optional] +Expected: compare should work as expected +*/ RUNNER_TEST(WidgetVersion_Compare_3) { RUNNER_ASSERT(WidgetVersion(L"1.00000000000000") >= WidgetVersion(L"1.0 test")); } +/* +Name: WidgetVersion_Compare_4 +Description: tests version comparision for huge numbers +Expected: compare should work as expected +*/ RUNNER_TEST(WidgetVersion_Compare_4) { RUNNER_ASSERT(WidgetVersion( @@ -268,16 +404,31 @@ RUNNER_TEST(WidgetVersion_Compare_4) > WidgetVersion(L"4324324324324324324321.000432")); } +/* +Name: WidgetVersion_Compare_5 +Description: tests equality in format [major].[minor] +Expected: versions should be equal +*/ RUNNER_TEST(WidgetVersion_Compare_5) { RUNNER_ASSERT(WidgetVersion(L"12345.1") == WidgetVersion(L"12345.1")); } +/* +Name: WidgetVersion_Compare_6 +Description: tests version equality in format [major].[minor] +Expected: versions should not be equal +*/ RUNNER_TEST(WidgetVersion_Compare_6) { RUNNER_ASSERT(WidgetVersion(L"1.1") != WidgetVersion(L"1.11")); } +/* +Name: WidgetVersion_Compare_7 +Description: tests version equality in format [major].[minor] [optional] +Expected: versions should be equal, optional part should not be taken into account +*/ RUNNER_TEST(WidgetVersion_Compare_7) { RUNNER_ASSERT(WidgetVersion(L"000123000.0 notatest") == diff --git a/tests/dpl/utils/wrt_utility.cpp b/tests/dpl/utils/wrt_utility.cpp index 6f8b3a8..eb78ed6 100644 --- a/tests/dpl/utils/wrt_utility.cpp +++ b/tests/dpl/utils/wrt_utility.cpp @@ -32,6 +32,11 @@ RUNNER_TEST_GROUP_INIT(DPL_WRT_UTILITY) +/* +Name: wrt_utility_WrtUtilJoinPaths +Description: join paths test +Expected: correctly used separator +*/ RUNNER_TEST(wrt_utility_WrtUtilJoinPaths) { std::string result; @@ -147,6 +152,11 @@ RUNNER_TEST(wrt_utility_WrtUtilRemoveDir_NoDirError) "Removing non existing directory returned success"); } +/* +Name: wrt_utility_WrtUtilFileExists +Description: tests file existence +Expected: existing file should be reported as existing +*/ RUNNER_TEST(wrt_utility_WrtUtilFileExists) { std::ofstream file; @@ -158,6 +168,11 @@ RUNNER_TEST(wrt_utility_WrtUtilFileExists) RUNNER_ASSERT(WrtUtilFileExists("/tmp/test_file1") == false); } +/* +Name: wrt_utility_WrtUtilDirExists +Description: tests directory existence +Expected: existing directory should be reported as existing +*/ RUNNER_TEST(wrt_utility_WrtUtilDirExists) { RUNNER_ASSERT(WrtUtilDirExists("/tmp")); -- 2.7.4