@@ -1773,6 +1773,121 @@ int test_notecard_sendRequest_does_not_modify_note_c_result_value_before_returni
1773
1773
return result;
1774
1774
}
1775
1775
1776
+ int test_notecard_sendRequestWithRetry_does_not_modify_j_object_parameter_value_before_passing_to_note_c ()
1777
+ {
1778
+ int result;
1779
+
1780
+ // Arrange
1781
+ // //////////
1782
+
1783
+ Notecard notecard;
1784
+ J * EXPECTED_JSON = reinterpret_cast <J *>(malloc (sizeof (J)));
1785
+ J * json_cpy;
1786
+ assert (nullptr != EXPECTED_JSON);
1787
+
1788
+ noteRequestWithRetry_Parameters.reset ();
1789
+ memset (EXPECTED_JSON, 0x55 , sizeof (J));
1790
+ {
1791
+ json_cpy = reinterpret_cast <J *>(malloc (sizeof (J)));
1792
+ assert (nullptr != json_cpy);
1793
+ memcpy (json_cpy, EXPECTED_JSON, sizeof (J));
1794
+ }
1795
+
1796
+ // Action
1797
+ // /////////
1798
+
1799
+ notecard.sendRequestWithRetry (json_cpy, 0 );
1800
+
1801
+ // Assert
1802
+ // /////////
1803
+
1804
+ if (!memcmp (EXPECTED_JSON, noteRequestWithRetry_Parameters.req , sizeof (J)))
1805
+ {
1806
+ result = 0 ;
1807
+ }
1808
+ else
1809
+ {
1810
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1811
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1812
+ std::cout << " \t noteRequestWithRetry_Parameters.req != EXPECTED_JSON" << std::endl;
1813
+ std::cout << " [" ;
1814
+ }
1815
+
1816
+ free (json_cpy);
1817
+ free (EXPECTED_JSON);
1818
+ return result;
1819
+ }
1820
+
1821
+ int test_notecard_sendRequestWithRetry_does_not_modify_timeout_parameter_value_before_passing_to_note_c ()
1822
+ {
1823
+ int result;
1824
+
1825
+ // Arrange
1826
+ // //////////
1827
+
1828
+ Notecard notecard;
1829
+ uint32_t EXPECTED_TIMEOUT = 10 ;
1830
+ noteRequestWithRetry_Parameters.reset ();
1831
+
1832
+ // Action
1833
+ // /////////
1834
+
1835
+ notecard.sendRequestWithRetry (nullptr , EXPECTED_TIMEOUT);
1836
+
1837
+ // Assert
1838
+ // /////////
1839
+
1840
+ if (EXPECTED_TIMEOUT == noteRequestWithRetry_Parameters.timeoutSeconds )
1841
+ {
1842
+ result = 0 ;
1843
+ }
1844
+ else
1845
+ {
1846
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1847
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1848
+ std::cout << " \t noteRequestWithRetry_Parameters.timeoutSeconds != EXPECTED_TIMEOUT" << std::endl;
1849
+ std::cout << " [" ;
1850
+ }
1851
+
1852
+ return result;
1853
+ }
1854
+
1855
+ int test_notecard_sendRequestWithRetry_does_not_modify_note_c_result_value_before_returning_to_caller ()
1856
+ {
1857
+ int result;
1858
+
1859
+ // Arrange
1860
+ // //////////
1861
+
1862
+ Notecard notecard;
1863
+ const bool EXPECTED_RESULT = true ;
1864
+
1865
+ noteRequestWithRetry_Parameters.reset ();
1866
+ noteRequestWithRetry_Parameters.result = EXPECTED_RESULT;
1867
+
1868
+ // Action
1869
+ // /////////
1870
+
1871
+ const bool ACTUAL_RESULT = notecard.sendRequestWithRetry (nullptr , 0 );
1872
+
1873
+ // Assert
1874
+ // /////////
1875
+
1876
+ if (EXPECTED_RESULT == ACTUAL_RESULT)
1877
+ {
1878
+ result = 0 ;
1879
+ }
1880
+ else
1881
+ {
1882
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
1883
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
1884
+ std::cout << " \t notecard.sendRequestWithRetry(nullptr, 0) == \" " << ACTUAL_RESULT << " \" , EXPECTED: \" " << EXPECTED_RESULT << " \" " << std::endl;
1885
+ std::cout << " [" ;
1886
+ }
1887
+
1888
+ return result;
1889
+ }
1890
+
1776
1891
int test_notecard_requestAndResponse_does_not_modify_j_object_parameter_value_before_passing_to_note_c ()
1777
1892
{
1778
1893
int result;
@@ -1862,6 +1977,129 @@ int test_notecard_requestAndResponse_does_not_modify_note_c_result_value_before_
1862
1977
return result;
1863
1978
}
1864
1979
1980
+ int test_notecard_requestAndResponseWithRetry_does_not_modify_j_object_parameter_value_before_passing_to_note_c ()
1981
+ {
1982
+ int result;
1983
+
1984
+ // Arrange
1985
+ // //////////
1986
+
1987
+ Notecard notecard;
1988
+ J *EXPECTED_JSON = reinterpret_cast <J *>(malloc (sizeof (J)));
1989
+ J *json_cpy;
1990
+ assert (nullptr != EXPECTED_JSON);
1991
+
1992
+ noteRequestResponseWithRetry_Parameters.reset ();
1993
+ memset (EXPECTED_JSON, 0x55 , sizeof (J));
1994
+ {
1995
+ json_cpy = reinterpret_cast <J *>(malloc (sizeof (J)));
1996
+ assert (nullptr != json_cpy);
1997
+ memcpy (json_cpy, EXPECTED_JSON, sizeof (J));
1998
+ }
1999
+
2000
+ // Action
2001
+ // /////////
2002
+
2003
+ notecard.requestAndResponseWithRetry (json_cpy, 0 );
2004
+
2005
+ // Assert
2006
+ // /////////
2007
+
2008
+ if (!memcmp (EXPECTED_JSON, noteRequestResponseWithRetry_Parameters.req , sizeof (J)))
2009
+ {
2010
+ result = 0 ;
2011
+ }
2012
+ else
2013
+ {
2014
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
2015
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
2016
+ std::cout << " \t noteRequestResponseWithRetry_Parameters.req != EXPECTED_JSON" << std::endl;
2017
+ std::cout << " [" ;
2018
+ }
2019
+
2020
+ free (json_cpy);
2021
+ free (EXPECTED_JSON);
2022
+ return result;
2023
+ }
2024
+
2025
+ int test_notecard_requestAndResponseWithRetry_does_not_modify_timeout_parameter_value_before_passing_to_note_c ()
2026
+ {
2027
+ int result;
2028
+
2029
+ // Arrange
2030
+ // //////////
2031
+
2032
+ Notecard notecard;
2033
+ uint32_t EXPECTED_TIMEOUT = 10 ;
2034
+ noteRequestResponseWithRetry_Parameters.reset ();
2035
+
2036
+ // Action
2037
+ // /////////
2038
+
2039
+ notecard.requestAndResponseWithRetry (nullptr , EXPECTED_TIMEOUT);
2040
+
2041
+ // Assert
2042
+ // /////////
2043
+
2044
+ if (EXPECTED_TIMEOUT == noteRequestResponseWithRetry_Parameters.timeoutSeconds )
2045
+ {
2046
+ result = 0 ;
2047
+ }
2048
+ else
2049
+ {
2050
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
2051
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
2052
+ std::cout << " \t noteRequestResponseWithRetry_Parameters.timeoutSeconds != EXPECTED_TIMEOUT" << std::endl;
2053
+ std::cout << " [" ;
2054
+ }
2055
+
2056
+ return result;
2057
+ }
2058
+
2059
+ int test_notecard_requestAndResponseWithRetry_does_not_modify_note_c_result_value_before_returning_to_caller ()
2060
+ {
2061
+ int result;
2062
+
2063
+ // Arrange
2064
+ // //////////
2065
+
2066
+ Notecard notecard;
2067
+ J * EXPECTED_JSON = reinterpret_cast <J *>(malloc (sizeof (J)));
2068
+ assert (nullptr != EXPECTED_JSON);
2069
+
2070
+ noteRequestResponseWithRetry_Parameters.reset ();
2071
+ memset (EXPECTED_JSON, 0x55 , sizeof (J));
2072
+ {
2073
+ noteRequestResponseWithRetry_Parameters.result = reinterpret_cast <J *>(malloc (sizeof (J)));
2074
+ assert (nullptr != noteRequestResponseWithRetry_Parameters.result );
2075
+ memcpy (noteRequestResponseWithRetry_Parameters.result , EXPECTED_JSON, sizeof (J));
2076
+ }
2077
+
2078
+ // Action
2079
+ // /////////
2080
+
2081
+ const J * const ACTUAL_RESULT = notecard.requestAndResponseWithRetry (nullptr , 0 );
2082
+
2083
+ // Assert
2084
+ // /////////
2085
+
2086
+ if (!memcmp (EXPECTED_JSON, ACTUAL_RESULT, sizeof (J)))
2087
+ {
2088
+ result = 0 ;
2089
+ }
2090
+ else
2091
+ {
2092
+ result = static_cast <int >(' n' + ' o' + ' t' + ' e' + ' c' + ' a' + ' r' + ' d' );
2093
+ std::cout << " \33 [31mFAILED\33 [0m] " << __FILE__ << " :" << __LINE__ << std::endl;
2094
+ std::cout << " \t notecard.requestAndResponseWithRetry(nullptr, 0) != EXPECTED_JSON" << std::endl;
2095
+ std::cout << " [" ;
2096
+ }
2097
+
2098
+ free (noteRequestResponseWithRetry_Parameters.result );
2099
+ free (EXPECTED_JSON);
2100
+ return result;
2101
+ }
2102
+
1865
2103
int test_notecard_deleteResponse_does_not_modify_j_object_parameter_pointer_before_passing_to_note_c ()
1866
2104
{
1867
2105
int result;
@@ -4276,8 +4514,14 @@ int main(void)
4276
4514
{test_notecard_newRequest_does_not_modify_note_c_result_value_before_returning_to_caller, " test_notecard_newRequest_does_not_modify_note_c_result_value_before_returning_to_caller" },
4277
4515
{test_notecard_sendRequest_does_not_modify_j_object_parameter_value_before_passing_to_note_c, " test_notecard_sendRequest_does_not_modify_j_object_parameter_value_before_passing_to_note_c" },
4278
4516
{test_notecard_sendRequest_does_not_modify_note_c_result_value_before_returning_to_caller, " test_notecard_sendRequest_does_not_modify_note_c_result_value_before_returning_to_caller" },
4517
+ {test_notecard_sendRequestWithRetry_does_not_modify_j_object_parameter_value_before_passing_to_note_c, " test_notecard_sendRequestWithRetry_does_not_modify_j_object_parameter_value_before_passing_to_note_c" },
4518
+ {test_notecard_sendRequestWithRetry_does_not_modify_timeout_parameter_value_before_passing_to_note_c, " test_notecard_sendRequestWithRetry_does_not_modify_timeout_parameter_value_before_passing_to_note_c" },
4519
+ {test_notecard_sendRequestWithRetry_does_not_modify_note_c_result_value_before_returning_to_caller, " test_notecard_sendRequestWithRetry_does_not_modify_note_c_result_value_before_returning_to_caller" },
4279
4520
{test_notecard_requestAndResponse_does_not_modify_j_object_parameter_value_before_passing_to_note_c, " test_notecard_requestAndResponse_does_not_modify_j_object_parameter_value_before_passing_to_note_c" },
4280
4521
{test_notecard_requestAndResponse_does_not_modify_note_c_result_value_before_returning_to_caller, " test_notecard_requestAndResponse_does_not_modify_note_c_result_value_before_returning_to_caller" },
4522
+ {test_notecard_requestAndResponseWithRetry_does_not_modify_j_object_parameter_value_before_passing_to_note_c, " test_notecard_requestAndResponseWithRetry_does_not_modify_j_object_parameter_value_before_passing_to_note_c" },
4523
+ {test_notecard_requestAndResponseWithRetry_does_not_modify_timeout_parameter_value_before_passing_to_note_c, " test_notecard_requestAndResponseWithRetry_does_not_modify_timeout_parameter_value_before_passing_to_note_c" },
4524
+ {test_notecard_requestAndResponseWithRetry_does_not_modify_note_c_result_value_before_returning_to_caller, " test_notecard_requestAndResponseWithRetry_does_not_modify_note_c_result_value_before_returning_to_caller" },
4281
4525
{test_notecard_deleteResponse_does_not_modify_j_object_parameter_pointer_before_passing_to_note_c, " test_notecard_deleteResponse_does_not_modify_j_object_parameter_pointer_before_passing_to_note_c" },
4282
4526
{test_notecard_logDebug_does_not_modify_string_parameter_value_before_passing_to_note_c, " test_notecard_logDebug_does_not_modify_string_parameter_value_before_passing_to_note_c" },
4283
4527
{test_notecard_logDebugf_does_not_modify_string_parameter_value_before_passing_to_note_c, " test_notecard_logDebugf_does_not_modify_string_parameter_value_before_passing_to_note_c" },
0 commit comments