commit 6c98c46cb497a43b867accda3890c5a8e11633e2
parent 7f9009248df8bebc4a0578bd47390a6e85096e03
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 28 Jul 2020 09:29:18 +0200
Fix some asserts (and spacing too)
Diffstat:
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/green-compute.c b/src/green-compute.c
@@ -46,7 +46,7 @@ check_green_table_variables_use
FOR_EACH(i, 0, green->counts.ok_count) {
const struct sample* sample = green->samples + i;
unsigned id = sample->header.end_id;
- ASSERT(!DESC_IS_H(green->descriptions[id].type));
+ ASSERT(!DESC_IS_SF(green->descriptions[id].type));
ASSERT(id <= green->counts.desc_count); /* Ambient ID is desc_count */
green->table[id].end_weight++;
@@ -216,7 +216,7 @@ green_compute_1
|| DESC_IS_T(green->descriptions[id].type)
|| DESC_IS_H(green->descriptions[id].type)
|| DESC_IS_MEDIUM(green->descriptions[id].type));
- ASSERT(green->table[id].end_defined);
+ ASSERT(green->table[id].end_defined && !green->table[id].end_unknown);
Ti = settings[id].end_value;
FOR_EACH(j, 0, sample->header.pw_count) {
@@ -224,7 +224,7 @@ green_compute_1
id = sample->pw_ids[j];
ASSERT(id < green->counts.desc_count);
ASSERT(DESC_IS_MEDIUM(green->descriptions[id].type));
- ASSERT(green->table[id].other_defined);
+ ASSERT(green->table[id].other_defined && !green->table[id].other_unknown);
Ti += w * settings[id].other_value;
}
FOR_EACH(j, 0, sample->header.fx_count) {
@@ -232,7 +232,7 @@ green_compute_1
id = sample->fx_ids[j];
ASSERT(id < green->counts.desc_count);
ASSERT(DESC_IS_F(green->descriptions[id].type));
- ASSERT(green->table[id].other_defined);
+ ASSERT(green->table[id].other_defined && !green->table[id].other_unknown);
Ti += w * settings[id].other_value;
}
T += Ti;
diff --git a/src/green-output.c b/src/green-output.c
@@ -108,10 +108,10 @@ green_print_result
ASSERT(green && out_stream);
sz = darray_str_size_get(&green->settings);
- for (i = 0; i < sz; i++) {
+ for(i = 0; i < sz; i++) {
struct result* result = darray_result_data_get(&green->results) + i;
const char* line = str_cget(darray_str_data_get(&green->settings) + i);
- if (mode & MODE_EXTENTED_RESULTS)
+ if(mode & MODE_EXTENTED_RESULTS)
fprintf(out_stream, "%g +/- %g ; %s\n", result->E, result->STD, line);
else fprintf(out_stream, "%g %g\n", result->E, result->STD);
}
diff --git a/src/green-types.h b/src/green-types.h
@@ -348,6 +348,8 @@ enum description_type {
((D) == DESC_BOUND_T_FOR_SOLID || (D) == DESC_BOUND_T_FOR_FLUID)
#define DESC_IS_F(D) \
((D) == DESC_BOUND_F_FOR_SOLID)
+#define DESC_IS_SF(D) \
+ ((D) == DESC_SOLID_FLUID_CONNECT)
struct mat_fluid {
struct str name;