Skip to content

Commit 055f734

Browse files
committed
nc_test/util.c replace assert(0) with abort()
1 parent c66fc5e commit 055f734

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/nc_test/util.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ inRange(const double value, const nc_type xtype)
3737
case NC_INT64: return value >= (double)X_INT64_MIN && value <= (double)X_INT64_MAX;
3838
case NC_UINT64: return value >= 0 && value <= (double)X_UINT64_MAX;
3939
default:
40-
assert(0);
41-
return(0);
40+
abort();
4241
}
4342
}
4443

@@ -464,7 +463,7 @@ hash(const nc_type xtype,
464463
case NC_INT64: return X_INT_MIN - 128.0; /* slight smaller
465464
than INT_MIN */
466465
case NC_UINT64: return 0;
467-
default: assert(0);
466+
default: abort();
468467
}
469468
case 1:
470469
switch (xtype) { /* test if can get/put MAX value */
@@ -483,7 +482,7 @@ hash(const nc_type xtype,
483482
/* slightly bigger than INT_MAX */
484483
case NC_UINT64: return X_UINT_MAX + 128.0;
485484
/* slightly bigger than UINT_MAX */
486-
default: assert(0);
485+
default: abort();
487486
}
488487
case 2:
489488
switch (xtype) { /* test if can detect out-of-boundary value */
@@ -500,7 +499,7 @@ hash(const nc_type xtype,
500499
case NC_UINT: return -1.0;
501500
case NC_INT64: return -1.0; /* skip test */
502501
case NC_UINT64: return -1.0;
503-
default: assert(0);
502+
default: abort();
504503
}
505504
case 3:
506505
switch (xtype) { /* test if can detect out-of-boundary value */
@@ -517,7 +516,7 @@ hash(const nc_type xtype,
517516
case NC_UINT: return X_UINT_MAX +1.0;
518517
case NC_INT64: return 1.0; /* skip test */
519518
case NC_UINT64: return 1.0; /* skip test */
520-
default: assert(0);
519+
default: abort();
521520
}
522521
}
523522
} else { /* for array with more than 4 elements, pick some random numbers */
@@ -538,7 +537,7 @@ hash(const nc_type xtype,
538537
case NC_UINT64: base = 20; break;
539538
default:
540539
base = 0;
541-
assert(0);
540+
abort();
542541
}
543542
if (rank < 0) { /* attribute */
544543
result = base * 7;
@@ -602,7 +601,7 @@ char2type(char letter) {
602601
case 'u': return NC_UINT;
603602
case 'x': return NC_INT64;
604603
case 'z': return NC_UINT64;
605-
default: assert(0);
604+
default: abort();
606605
}
607606
return NC_CHAR; /* Just to keep compiler happy */
608607
}

0 commit comments

Comments
 (0)