Lines Matching defs:function
162 * <li><strong>will_return(function, value)</strong> - The will_return() macro
202 * @brief Retrieve a return value of the current function.
204 * @return The value which was stored to return by this function.
215 * @brief Retrieve a typed return value of the current function.
222 * @return The value which was stored to return by this function.
241 * @brief Retrieve a typed return value of the current function.
249 * @return The value which was stored to return by this function.
271 * @param[in] #function The function which should return the given value.
292 void will_return(#function, LargestIntegralType value);
294 #define will_return(function, value) \
295 _will_return(#function, __FILE__, __LINE__, \
303 * @param[in] #function The function which should return the given value.
313 void will_return_count(#function, LargestIntegralType value, int count);
315 #define will_return_count(function, value, count) \
316 _will_return(#function, __FILE__, __LINE__, \
324 * @param[in] #function The function which should return the given value.
330 * will_return_count(function, value, -1);
336 void will_return_always(#function, LargestIntegralType value);
338 #define will_return_always(function, value) \
339 will_return_count(function, (value), -1)
348 * Functionality to store expected values for mock function parameters.
351 * functionality to store expected values for mock function parameters using
352 * the expect_*() functions provided. A mock function parameter can then be
356 * the specified parameter. check_expected() checks a function parameter
361 * The following test stub illustrates how to do this. First is the the function
371 * Now the chef_cook function can check if the parameter we got passed is the
389 * Add a custom parameter checking function. If the event parameter is NULL
390 * the event structure is allocated internally by this function. If event
396 * @brief Add a custom parameter checking function.
399 * by this function. If the parameter is provided it must be allocated on the
402 * @param[in] #function The function to add a custom parameter checking
403 * function for.
405 * @param[in] #parameter The parameters passed to the function.
407 * @param[in] #check_function The check function to call.
409 * @param[in] check_data The data to pass to the check function.
411 void expect_check(#function, #parameter, #check_function, const void *check_data);
413 #define expect_check(function, parameter, check_function, check_data) \
414 _expect_check(#function, #parameter, __FILE__, __LINE__, check_function, \
423 * The event is triggered by calling check_expected() in the mocked function.
425 * @param[in] #function The function to add the check for.
427 * @param[in] #parameter The name of the parameter passed to the function.
433 void expect_in_set(#function, #parameter, LargestIntegralType value_array[]);
435 #define expect_in_set(function, parameter, value_array) \
436 expect_in_set_count(function, parameter, value_array, 1)
444 * The event is triggered by calling check_expected() in the mocked function.
446 * @param[in] #function The function to add the check for.
448 * @param[in] #parameter The name of the parameter passed to the function.
458 void expect_in_set_count(#function, #parameter, LargestIntegralType value_array[], size_t count);
460 #define expect_in_set_count(function, parameter, value_array, count) \
461 _expect_in_set(#function, #parameter, __FILE__, __LINE__, value_array, \
470 * The event is triggered by calling check_expected() in the mocked function.
472 * @param[in] #function The function to add the check for.
474 * @param[in] #parameter The name of the parameter passed to the function.
480 void expect_not_in_set(#function, #parameter, LargestIntegralType value_array[]);
482 #define expect_not_in_set(function, parameter, value_array) \
483 expect_not_in_set_count(function, parameter, value_array, 1)
491 * The event is triggered by calling check_expected() in the mocked function.
493 * @param[in] #function The function to add the check for.
495 * @param[in] #parameter The name of the parameter passed to the function.
505 void expect_not_in_set_count(#function, #parameter, LargestIntegralType value_array[], size_t count);
507 #define expect_not_in_set_count(function, parameter, value_array, count) \
509 #function, #parameter, __FILE__, __LINE__, value_array, \
519 * The event is triggered by calling check_expected() in the mocked function.
521 * @param[in] #function The function to add the check for.
523 * @param[in] #parameter The name of the parameter passed to the function.
531 void expect_in_range(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum);
533 #define expect_in_range(function, parameter, minimum, maximum) \
534 expect_in_range_count(function, parameter, minimum, maximum, 1)
542 * The event is triggered by calling check_expected() in the mocked function.
544 * @param[in] #function The function to add the check for.
546 * @param[in] #parameter The name of the parameter passed to the function.
558 void expect_in_range_count(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count);
560 #define expect_in_range_count(function, parameter, minimum, maximum, count) \
561 _expect_in_range(#function, #parameter, __FILE__, __LINE__, minimum, \
570 * The event is triggered by calling check_expected() in the mocked function.
572 * @param[in] #function The function to add the check for.
574 * @param[in] #parameter The name of the parameter passed to the function.
582 void expect_not_in_range(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum);
584 #define expect_not_in_range(function, parameter, minimum, maximum) \
585 expect_not_in_range_count(function, parameter, minimum, maximum, 1)
593 * The event is triggered by calling check_expected() in the mocked function.
595 * @param[in] #function The function to add the check for.
597 * @param[in] #parameter The name of the parameter passed to the function.
609 void expect_not_in_range_count(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count);
611 #define expect_not_in_range_count(function, parameter, minimum, maximum, \
613 _expect_not_in_range(#function, #parameter, __FILE__, __LINE__, \
621 * The event is triggered by calling check_expected() in the mocked function.
623 * @param[in] #function The function to add the check for.
625 * @param[in] #parameter The name of the parameter passed to the function.
631 void expect_value(#function, #parameter, LargestIntegralType value);
633 #define expect_value(function, parameter, value) \
634 expect_value_count(function, parameter, value, 1)
641 * The event is triggered by calling check_expected() in the mocked function.
643 * @param[in] #function The function to add the check for.
645 * @param[in] #parameter The name of the parameter passed to the function.
655 void expect_value_count(#function, #parameter, LargestIntegralType value, size_t count);
657 #define expect_value_count(function, parameter, value, count) \
658 _expect_value(#function, #parameter, __FILE__, __LINE__, \
666 * The event is triggered by calling check_expected() in the mocked function.
668 * @param[in] #function The function to add the check for.
670 * @param[in] #parameter The name of the parameter passed to the function.
676 void expect_not_value(#function, #parameter, LargestIntegralType value);
678 #define expect_not_value(function, parameter, value) \
679 expect_not_value_count(function, parameter, value, 1)
686 * The event is triggered by calling check_expected() in the mocked function.
688 * @param[in] #function The function to add the check for.
690 * @param[in] #parameter The name of the parameter passed to the function.
700 void expect_not_value_count(#function, #parameter, LargestIntegralType value, size_t count);
702 #define expect_not_value_count(function, parameter, value, count) \
703 _expect_not_value(#function, #parameter, __FILE__, __LINE__, \
712 * The event is triggered by calling check_expected() in the mocked function.
714 * @param[in] #function The function to add the check for.
716 * @param[in] #parameter The name of the parameter passed to the function.
722 void expect_string(#function, #parameter, const char *string);
724 #define expect_string(function, parameter, string) \
725 expect_string_count(function, parameter, string, 1)
733 * The event is triggered by calling check_expected() in the mocked function.
735 * @param[in] #function The function to add the check for.
737 * @param[in] #parameter The name of the parameter passed to the function.
747 void expect_string_count(#function, #parameter, const char *string, size_t count);
749 #define expect_string_count(function, parameter, string, count) \
750 _expect_string(#function, #parameter, __FILE__, __LINE__, \
759 * The event is triggered by calling check_expected() in the mocked function.
761 * @param[in] #function The function to add the check for.
763 * @param[in] #parameter The name of the parameter passed to the function.
769 void expect_not_string(#function, #parameter, const char *string);
771 #define expect_not_string(function, parameter, string) \
772 expect_not_string_count(function, parameter, string, 1)
780 * The event is triggered by calling check_expected() in the mocked function.
782 * @param[in] #function The function to add the check for.
784 * @param[in] #parameter The name of the parameter passed to the function.
794 void expect_not_string_count(#function, #parameter, const char *string, size_t count);
796 #define expect_not_string_count(function, parameter, string, count) \
797 _expect_not_string(#function, #parameter, __FILE__, __LINE__, \
805 * The event is triggered by calling check_expected() in the mocked function.
807 * @param[in] #function The function to add the check for.
809 * @param[in] #parameter The name of the parameter passed to the function.
817 void expect_memory(#function, #parameter, void *memory, size_t size);
819 #define expect_memory(function, parameter, memory, size) \
820 expect_memory_count(function, parameter, memory, size, 1)
828 * The event is triggered by calling check_expected() in the mocked function.
830 * @param[in] #function The function to add the check for.
832 * @param[in] #parameter The name of the parameter passed to the function.
844 void expect_memory_count(#function, #parameter, void *memory, size_t size, size_t count);
846 #define expect_memory_count(function, parameter, memory, size, count) \
847 _expect_memory(#function, #parameter, __FILE__, __LINE__, \
856 * The event is triggered by calling check_expected() in the mocked function.
858 * @param[in] #function The function to add the check for.
860 * @param[in] #parameter The name of the parameter passed to the function.
868 void expect_not_memory(#function, #parameter, void *memory, size_t size);
870 #define expect_not_memory(function, parameter, memory, size) \
871 expect_not_memory_count(function, parameter, memory, size, 1)
879 * The event is triggered by calling check_expected() in the mocked function.
881 * @param[in] #function The function to add the check for.
883 * @param[in] #parameter The name of the parameter passed to the function.
895 void expect_not_memory_count(#function, #parameter, void *memory, size_t size, size_t count);
897 #define expect_not_memory_count(function, parameter, memory, size, count) \
898 _expect_not_memory(#function, #parameter, __FILE__, __LINE__, \
907 * The event is triggered by calling check_expected() in the mocked function.
909 * @param[in] #function The function to add the check for.
911 * @param[in] #parameter The name of the parameter passed to the function.
915 void expect_any(#function, #parameter);
917 #define expect_any(function, parameter) \
918 expect_any_count(function, parameter, 1)
926 * The event is triggered by calling check_expected() in the mocked function.
928 * @param[in] #function The function to add the check for.
930 * @param[in] #parameter The name of the parameter passed to the function.
938 void expect_any_count(#function, #parameter, size_t count);
940 #define expect_any_count(function, parameter, count) \
941 _expect_any(#function, #parameter, __FILE__, __LINE__, count)
946 * @brief Determine whether a function parameter is correct.
951 * This function needs to be called in the mock object.
964 * @brief Determine whether a function parameter is correct.
969 * This function needs to be called in the mock object.
1005 * The function prints an error message to standard error and terminates the
1024 * The function prints an error message to standard error and terminates the
1042 * The function prints an error message to standard error and terminates the
1043 * test by calling fail() if the return code is smaller than 0. If the function
1044 * you check sets an errno if it fails you can pass it to the function and
1064 * The function prints an error message to standard error and terminates the
1081 * The function prints an error message to standard error and terminates the
1098 * The function prints an error message and terminates the test by calling
1117 * The function prints an error message and terminates the test by calling
1136 * The function prints an error message to standard error and terminates the
1155 * The function prints an error message to standard error and terminates the
1176 * The function prints an error message to standard error and terminates the
1194 * The function prints an error message to standard error and terminates the
1212 * The function prints an error message to standard error and terminates the
1234 * The function prints an error message to standard error and terminates the
1257 * The function prints an error message to standard error and terminates the
1280 * The function prints an error message to standard error and terminates the
1302 * The function prints an error message to standard error and terminates the
1321 * The function prints an error message to standard error and terminates the
1409 * @deprecated This function was deprecated in favor of cmocka_run_group_tests
1411 * @param[in] #function The function to test.
1425 int run_test(#function);
1436 * @deprecated This function was deprecated in favor of cmocka_unit_test
1443 /** Initializes a UnitTest structure with a setup function.
1445 * @deprecated This function was deprecated in favor of cmocka_unit_test_setup
1455 /** Initializes a UnitTest structure with a teardown function.
1457 * @deprecated This function was deprecated in favor of cmocka_unit_test_teardown
1464 /** Initializes a UnitTest structure for a group setup function.
1466 * @deprecated This function was deprecated in favor of cmocka_run_group_tests
1471 /** Initializes a UnitTest structure for a group teardown function.
1473 * @deprecated This function was deprecated in favor of cmocka_run_group_tests
1479 * Initialize an array of UnitTest structures with a setup function for a test
1480 * and a teardown function. Either setup or teardown can be NULL.
1482 * @deprecated This function was deprecated in favor of
1494 /** Initializes a CMUnitTest structure with a setup function. */
1497 /** Initializes a CMUnitTest structure with a teardown function. */
1501 * Initialize an array of CMUnitTest structures with a setup function for a test
1502 * and a teardown function. Either setup or teardown can be NULL.
1515 * @param[in] group_setup The setup function which should be called before
1518 * @param[in] group_teardown The teardown function to be called after all
1583 * @param[in] group_setup The setup function which should be called before
1586 * @param[in] group_teardown The teardown function to be called after all
1670 * @brief Test function overriding malloc.
1698 * @brief Test function overriding calloc.
1717 * @brief Test function overriding realloc which detects buffer overruns
1733 * @brief Test function overriding free(3).
1762 * redefined in modules being tested to use cmocka's mock_assert() function.
1763 * Normally mock_assert() signals a test failure. If a function is called using
1765 * function will result in the execution of the test. If no calls to
1766 * mock_assert() occur during the function called via expect_assert_failure() a
1814 * @param[in] fn_call The function will will call mock_assert().
1831 void expect_assert_failure(function fn_call);
1855 /* Function that determines whether a function parameter value is correct. */
1859 /* Type of the unit test function. */
1869 * Stores a unit test function with its name and type.
1870 * NOTE: Every setup function must be paired with a teardown function. It's
1871 * possible to specify NULL function pointers.
1875 UnitTestFunction function;
1918 /* Retrieves a value for the given function, as set by "will_return". */
1919 LargestIntegralType _mock(const char * const function, const char* const file,
1923 const char* const function, const char* const parameter,
1930 const char* const function, const char* const parameter,
1934 const char* const function, const char* const parameter,
1939 const char* const function, const char* const parameter,
1944 const char* const function, const char* const parameter,
1950 const char* const function, const char* const parameter,
1954 const char* const function, const char* const parameter,
1959 const char* const function, const char* const parameter,
1963 const char* const function, const char* const parameter,
1968 const char* const function, const char* const parameter,
1972 const char* const function, const char* const parameter,
1977 const char* const function, const char* const parameter,
2068 * function or overriden with environment variable CMOCKA_MESSAGE_OUTPUT.