b0VIM 7.4^R/Xì”ó=rmusialmbp~rmusial/src/git/mbpfan/src/minunit.c 3210#"! UtpŽ[�ad6ŠŽãмª–‚iUA+ÖÔÓ¸¤ŸbaÛ ¾ ½ ¢ ¡ p   º ¹ « © ¨ �  R  ÿ æ › š z #   ÿ ù ø ê è ç æ  À œ n V : 9 õ × Í Ì ³ ­ ¬ w i g f Q O 2  íßÞµ„~}lji6ôóßÈ¥”Љ|mgYWV31СR@œŽŒ‹ecO0ÖÕÀ®¨§†w*) ûõôxüЉ mu_assert("Could not read low_temp from config file",settings_get_int(settings, "general", "low_temp") != 0); mu_assert("Could not read max_fan_speed from config file",settings_get_int(settings, "general", "max_fan_speed") != 0); mu_assert("Could not read min_fan_speed from config file",settings_get_int(settings, "general", "min_fan_speed") != 0); } return 0; if (settings == NULL) { mu_assert("Could not read settings from config file", settings != NULL); fclose(f); settings = settings_open(f); } return 0; if (f == NULL) { mu_assert("No config file found", f != NULL); f = fopen("/etc/mbpfan.conf", "r"); Settings *settings = NULL; FILE *f = NULL;{static const char *test_config_file()} return 0; mu_assert("Invalid Higher temp test (if fan was already spinning high, this is not worrying)", temp_1 < temp_2); unsigned short temp_2 = get_temp(sensors); stress(2000); mu_assert("Invalid Global Temperature Found", temp_1 > 1 && temp_1 < 150); unsigned short temp_1 = get_temp(sensors); mu_assert("No sensors found", sensors != NULL); t_sensors* sensors = retrieve_sensors();{static const char *test_get_temp()} return 0; } n = f; f--; } n--; srand ( time_seed() ); while(n > 0) { while (f > 0) { int f = n;{int stress(int n)// stress a little bit the CPU// nothing better than a horrible piece of code to} return seed; } seed = seed * ( UCHAR_MAX + 2U ) + p[i]; for ( i = 0; i < sizeof now; i++ ) { size_t i; unsigned seed = 0; unsigned char *p = (unsigned char *)&now; time_t now = time ( 0 );{unsigned time_seed()} return 0; mu_assert("No fans found", found_fan_path != 0); } tmp = tmp->next; } found_fan_path++; if(tmp->fan_output_path != NULL) { while(tmp != NULL) { int found_fan_path = 0; t_fans* tmp = fans; mu_assert("No fans found", fans != NULL); t_fans* fans = retrieve_fans();{static const char *test_fan_paths()} return 0; } tmp = tmp->next; } mu_assert("Sensor does not have valid temperature", tmp->temperature > 0); if(tmp->path != NULL) { mu_assert("Sensor does not have a valid path", tmp->path != NULL); while(tmp != NULL) { t_sensors* tmp = sensors; mu_assert("No sensors found", sensors != NULL); t_sensors* sensors = retrieve_sensors();{static const char *test_sensor_paths()} return 0; mu_assert("Non-legacy kernel not detected by mbpfan", is_legacy_kernel() == 0); else mu_assert("Legacy kernel not detected by mbpfan.", is_legacy_kernel() == 1); if ((kern_major_release <= 3) && minor < 15) int minor = atoi(pch); pch = strtok(NULL, "."); pch = strtok(kernel.release, "."); char *pch; mu_assert("Kernel major version is minor than 3.", kern_major_release > 2); int kern_major_release = (int)(kernel.release[0] - '0'); uname(&kernel); struct utsname kernel;{static const char *test_is_legacy_kernel()int tests_run = 0;#include "minunit.h"#include "settings.h"#include "mbpfan.h"#include "global.h"#include #include #include #include #include #include /* file minunit_example.c */adx[Œ˜rSRDBAî ¥ b : ñ ®   ž � ‹ Š j h g R A + ù ê é Ü Æ · ± ¯ ® … ƒ f S     Ù × º ’ @ é ™ † 0 ṫ©¨§ˆ†^:ùÖ¶�i[YXLJ$äß¹¸¡€rLFEÿ} return result != 0; printf("Tests run: %d\n", tests_run); } printf("ALL TESTS PASSED\n"); } else { printf("%s \n", result); if (result != 0) { const char *result = all_tests(); printf("It is normal for them to take a bit to finish.\n"); printf("Starting the tests..\n");{int tests()} return 0; mu_run_test(test_settings_reload); mu_run_test(test_sighup_receive); mu_run_test(test_settings); mu_run_test(test_config_file); mu_run_test(test_get_temp); mu_run_test(test_fan_paths); mu_run_test(test_sensor_paths); mu_run_test(test_is_legacy_kernel);{static const char *all_tests()} return 0; retrieve_settings("./mbpfan.conf"); mu_assert("polling_interval is not 1 after SIHUP", polling_interval == 1); mu_assert("min_fan_speed value is not 6200 after SIGHUP", min_fan_speed == 6200); raise(SIGHUP); mu_assert("polling_interval is not 7 before SIHUP", polling_interval == 7); mu_assert("min_fan_speed value is not 2000 before SIGHUP", min_fan_speed == 2000); printf("Testing the _supplied_ mbpfan.conf (not the one you are using)..\n"); retrieve_settings("./mbpfan.conf"); signal(SIGHUP, handler);{static const char *test_settings_reload()} return 0; mu_assert("did not receive SIGHUP signal", received == 1); raise(SIGHUP); signal(SIGHUP, handler);{static const char *test_sighup_receive()} } break; received = 0; default: break; retrieve_settings("./mbpfan.conf.test1"); received = 1; case SIGHUP: switch(signal) {{static void handler(int signal)int received = 0;} return 0; mu_assert("polling_interval is not 7", polling_interval == 7); mu_assert("min_fan_speed value is not 2000", min_fan_speed == 2000); retrieve_settings("./mbpfan.conf"); mu_assert("polling_interval is not 1", polling_interval == 1); mu_assert("max_fan_speed value is not 6200", max_fan_speed == 6200); retrieve_settings("./mbpfan.conf.test1");{static const char *test_settings()} return 0; settings_delete(settings); /* Destroy the settings object */ mu_assert("Could not read polling_interval from config file",settings_get_int(settings, "general", "polling_interval") != 0); mu_assert("Could not read max_temp from config file",settings_get_int(settings, "general", "max_temp") != 0); mu_assert("Could not read high_temp from config file",settings_get_int(settings, "general", "high_temp") != 0);