Sha256: 0fe2f754fc5a0f3d66927e849e5eec6551a5103ab90d8bee8ba7e97de9bd5062
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
#include "../foundationallib.h" #include <assert.h> #include <stdio.h> #include <stdlib.h> // Define the Set data structure struct Set { // Implementation details omitted for brevity }; // Define the function to be tested void frozen_set_iter(struct Set *set, void (*callback)(char *key)) { // Implementation details omitted for brevity } // Define the callback function for testing void test_callback(char *key) { // Implementation of the test callback function for testing } // Test case 1: Test with an empty set void test_empty_set() { struct Set *empty_set = (struct Set *)malloc(sizeof(struct Set)); assert(empty_set != NULL); frozen_set_iter(empty_set, test_callback); free(empty_set); } // Test case 2: Test with a set containing one key void test_single_key_set() { struct Set *single_key_set = (struct Set *)malloc(sizeof(struct Set)); assert(single_key_set != NULL); // Add a key to the set frozen_set_iter(single_key_set, test_callback); free(single_key_set); } // Test case 3: Test with a set containing multiple keys void test_multiple_keys_set() { struct Set *multiple_keys_set = (struct Set *)malloc(sizeof(struct Set)); assert(multiple_keys_set != NULL); // Add multiple keys to the set frozen_set_iter(multiple_keys_set, test_callback); free(multiple_keys_set); } int main() { // Run the test cases test_empty_set(); test_single_key_set(); test_multiple_keys_set(); printf("All test cases passed!\n"); return 0; }
Version data entries
3 entries across 3 versions & 2 rubygems