* @brief check the result * @param data_buf original data * @param res_buf updated data * @param num the number of checking data * @return 0-pass, 1-fail */
| 42 | * @return 0-pass, 1-fail |
| 43 | */ |
| 44 | int check_data(t_data* data_buf, t_data* res_buf, const int num) { |
| 45 | // check the result by their sums because distribution on load balance is NOT order-preserving. |
| 46 | int sum_gld = 0; |
| 47 | int sum_res = 0; |
| 48 | for (int i = 0; i < num; ++i) { |
| 49 | t_data new_data = update_data(data_buf[i]); |
| 50 | sum_gld += calculate(new_data); |
| 51 | sum_res += calculate(res_buf[i]); |
| 52 | } |
| 53 | return (sum_gld != sum_res); |
| 54 | } |
| 55 | |
| 56 | int main() { |
| 57 | t_data* data_ddr = (t_data*)malloc(DATA_LEN * sizeof(t_data)); |
no test coverage detected