Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517#include "sc2k/sim/water_pollution.hpp"
#include <algorithm>#include <array>#include <cstdint>#include <cstdio>#include <limits>#include <optional>#include <vector>
#include "test_harness.hpp"
using namespace sc2k::sim;
static WaterPollutionState state_for(std::uint32_t rows, std::uint32_t columns) { const std::optional<WaterPollutionState> state = make_water_pollution_state(rows, columns); CHECK(state.has_value()); return state.value_or(WaterPollutionState{});}
static void test_constants_and_packed_compatibility() { CHECK(kMaximumStoredWaterPollution == 32767); CHECK(kExpectedMaximumWaterPollution == 11000); CHECK(kWaterPollutedThreshold == 2000); CHECK(kWaterPollutionRiseCap == 916); CHECK(kWaterPollutionDecayCap == 91);
const std::uint32_t packed = kPackedPollutionFlagsMask | (std::uint32_t(12345) << 15) | 2345u; CHECK(packed_water_pollution(packed) == 2345); CHECK(packed_air_pollution(packed) == 12345); CHECK(packed_pollution_flags(packed) == kPackedPollutionFlagsMask);
const std::uint32_t changedWater = with_packed_water_pollution(packed, 40000); CHECK(packed_water_pollution(changedWater) == 32767); CHECK(packed_air_pollution(changedWater) == 12345); CHECK(packed_pollution_flags(changedWater) == kPackedPollutionFlagsMask);
const std::uint32_t changedAir = with_packed_air_pollution(packed, -1); CHECK(packed_water_pollution(changedAir) == 2345); CHECK(packed_air_pollution(changedAir) == 0); CHECK(packed_pollution_flags(changedAir) == kPackedPollutionFlagsMask);}
static void test_geometry_accessors_and_validation() { CHECK(water_pollution_cell_extent(0) == 0); CHECK(water_pollution_cell_extent(4) == 2); CHECK(water_pollution_cell_extent(5) == 3); CHECK(valid_water_pollution_state(WaterPollutionState{})); CHECK(!make_water_pollution_state(0, 5).has_value()); CHECK(!make_water_pollution_state(5, 0).has_value());
WaterPollutionState state = state_for(5, 3); CHECK(state.cells.size() == 6); CHECK(valid_water_pollution_state_for_extent(state, 5, 3)); CHECK(!valid_water_pollution_state_for_extent(state, 5, 4)); CHECK(set_water_pollution(state, 0, 0, 40000)); CHECK(water_pollution_at(state, 0, 0) == 32767); CHECK(water_pollution_at(state, 0, 1) == 32767); CHECK(water_pollution_at(state, 1, 0) == 32767); CHECK(water_pollution_at(state, 1, 1) == 32767); CHECK(set_water_pollution(state, 4, 2, 1999)); CHECK(water_pollution_at(state, 4, 2) == 1999); CHECK(!water_pollution_at(state, 5, 2).has_value()); CHECK(!water_pollution_at(state, 4, 3).has_value()); CHECK(!set_water_pollution(state, std::uint32_t(-1), 0, 5));
WaterPollutionState malformed = state; malformed.cells.pop_back(); CHECK(!valid_water_pollution_state(malformed)); malformed = state; malformed.cells[0] = 32768; CHECK(!valid_water_pollution_state(malformed)); malformed = state; malformed.policyVersion += 1; CHECK(!valid_water_pollution_state(malformed)); malformed = state; malformed.fullRows = 0; CHECK(!valid_water_pollution_state(malformed));}
static void test_response_and_pump_primitives() { CHECK(!water_is_polluted(1999)); CHECK(water_is_polluted(2000)); CHECK(water_pollution_target(0) == 0); CHECK(water_pollution_target(3999) == 999); CHECK(water_pollution_target(4000) == 1000); CHECK(water_pollution_target(std::numeric_limits<std::uint64_t>::max()) == 32767);
CHECK(track_water_pollution_target(0, 32767) == 916); CHECK(track_water_pollution_target(1000, 1050) == 1050); CHECK(track_water_pollution_target(1000, 0) == 909); CHECK(track_water_pollution_target(50, 0) == 0); CHECK(track_water_pollution_target(1000, 950) == 950);
CHECK(water_pollution_derated_pump_capacity(100, 0) == 100); CHECK(water_pollution_derated_pump_capacity(100, 5500) == 50); CHECK(water_pollution_derated_pump_capacity(11000, 10999) == 1); CHECK(water_pollution_derated_pump_capacity(11000, 11000) == 0); CHECK(water_pollution_derated_pump_capacity(11000, 32767) == 0); CHECK(water_pollution_derated_pump_capacity( std::numeric_limits<std::uint64_t>::max(), 0) == std::numeric_limits<std::uint64_t>::max());
using water_pollution_detail::floor_multiply_divide; for (std::uint64_t denominator = 1; denominator <= 64; ++denominator) for (std::uint64_t left = 0; left <= denominator; ++left) for (std::uint64_t right = 0; right <= denominator; ++right) CHECK(floor_multiply_divide(left, right, denominator) == left * right / denominator); CHECK(floor_multiply_divide(3, 6, 10) == 1); CHECK(floor_multiply_divide(10, 6, 10) == 6); const std::uint64_t maximum = std::numeric_limits<std::uint64_t>::max(); CHECK(floor_multiply_divide(maximum - 1, maximum - 1, maximum) == maximum - 2);}
static void test_atomic_component_local_update() { const WaterPollutionState initial = state_for(4, 4); std::array<WaterPollutionSource, 4> sources{{ {0, 0, 7, 4000}, {1, 1, 7, 2000}, {0, 1, 8, 1000}, {3, 3, kDisconnectedWaterPollutionComponent, 400}, }}; std::array<WaterPollutionTreatment, 4> treatment{{ {8, 500}, {9, 100}, {7, 2500}, {7, 500}, }}; const WaterPollutionAdvance advanced = advance_water_pollution(initial, 5, sources, treatment); CHECK(advanced.status == WaterPollutionAdvanceStatus::Advanced); CHECK(initial.lastProcessedPeriod == -1); CHECK(initial.cells == std::vector<std::uint16_t>({0, 0, 0, 0})); CHECK(advanced.nextState.lastProcessedPeriod == 5); CHECK(advanced.nextState.cells == std::vector<std::uint16_t>({875, 0, 0, 100})); CHECK(advanced.positiveSourceUnits == 7400); CHECK(advanced.sourceReductionUnits == 0); CHECK(advanced.rawSourceUnits == 7400); CHECK(advanced.treatedSourceUnits == 3500); CHECK(advanced.postTreatmentSourceUnits == 3900); CHECK(advanced.treatmentAllocations.size() == 3); CHECK(advanced.treatmentAllocations[0] == (WaterPollutionTreatmentAllocation{7, 6000, 3000, 3000, 0})); CHECK(advanced.treatmentAllocations[1] == (WaterPollutionTreatmentAllocation{8, 1000, 500, 500, 0})); CHECK(advanced.treatmentAllocations[2] == (WaterPollutionTreatmentAllocation{9, 0, 100, 0, 100})); CHECK(advanced.cells.size() == 4); CHECK(advanced.cells[0] == (WaterPollutionCellProbe{0, 0, 7000, 0, 7000, 3500, 3500, 875, 0, 875})); CHECK(advanced.cells[3] == (WaterPollutionCellProbe{1, 1, 400, 0, 400, 0, 400, 100, 0, 100})); CHECK(valid_water_pollution_state(advanced.nextState));
std::reverse(sources.begin(), sources.end()); std::reverse(treatment.begin(), treatment.end()); const WaterPollutionAdvance reversed = advance_water_pollution(initial, 5, sources, treatment); CHECK(reversed == advanced);
const WaterPollutionAdvance duplicate = advance_water_pollution( advanced.nextState, 5, sources, treatment); CHECK(duplicate.status == WaterPollutionAdvanceStatus::AlreadyProcessed); CHECK(duplicate.nextState == advanced.nextState);}
static void test_signed_reducers_precede_component_treatment() { const WaterPollutionState initial = state_for(2, 2); std::array<WaterPollutionSource, 3> sources{{ {0, 0, 5, 3}, {1, 1, 7, 7}, {0, 1, kDisconnectedWaterPollutionComponent, 4, WaterPollutionSourceKind::Reducer}, }}; const std::array<WaterPollutionTreatment, 1> treatment{{{5, 1}}}; const WaterPollutionAdvance advanced = advance_water_pollution(initial, 0, sources, treatment); CHECK(advanced.status == WaterPollutionAdvanceStatus::Advanced); CHECK(advanced.positiveSourceUnits == 10); CHECK(advanced.sourceReductionUnits == 4); CHECK(advanced.rawSourceUnits == 6); CHECK(advanced.treatedSourceUnits == 1); CHECK(advanced.postTreatmentSourceUnits == 5); CHECK(advanced.treatmentAllocations == std::vector<WaterPollutionTreatmentAllocation>( {{5, 1, 1, 1, 0}})); CHECK(advanced.cells == std::vector<WaterPollutionCellProbe>( {{0, 0, 10, 4, 6, 1, 5, 1, 0, 1}}));
std::reverse(sources.begin(), sources.end()); CHECK(advance_water_pollution(initial, 0, sources, treatment) == advanced);
const std::array<WaterPollutionSource, 2> saturated{{ {0, 0, 5, 3}, {0, 0, kDisconnectedWaterPollutionComponent, 30, WaterPollutionSourceKind::Reducer}, }}; const std::array<WaterPollutionTreatment, 0> noTreatment{}; const WaterPollutionAdvance clamped = advance_water_pollution(initial, 0, saturated, noTreatment); CHECK(clamped.status == WaterPollutionAdvanceStatus::Advanced); CHECK(clamped.positiveSourceUnits == 3); CHECK(clamped.sourceReductionUnits == 3); CHECK(clamped.rawSourceUnits == 0); CHECK(clamped.nextState.cells == std::vector<std::uint16_t>({0}));}
static void test_decay_treatment_order_and_disconnection() { WaterPollutionState decaying = state_for(4, 4); decaying.cells = {100, 50, 1000, 32767}; const std::array<WaterPollutionSource, 0> noSources{}; const std::array<WaterPollutionTreatment, 0> noTreatment{}; const WaterPollutionAdvance decay = advance_water_pollution(decaying, 0, noSources, noTreatment); CHECK(decay.status == WaterPollutionAdvanceStatus::Advanced); CHECK(decay.nextState.cells == std::vector<std::uint16_t>({9, 0, 909, 32676}));
const WaterPollutionState initial = state_for(4, 4); const std::array<WaterPollutionSource, 2> sameComponent{{ {0, 2, 5, 4000}, {0, 0, 5, 4000}, }}; const std::array<WaterPollutionTreatment, 1> finite{{{5, 5000}}}; const WaterPollutionAdvance allocated = advance_water_pollution(initial, 0, sameComponent, finite); CHECK(allocated.status == WaterPollutionAdvanceStatus::Advanced); CHECK(allocated.cells[0].treatedSourceUnits == 4000); CHECK(allocated.cells[0].next == 0); CHECK(allocated.cells[1].treatedSourceUnits == 1000); CHECK(allocated.cells[1].next == 750);
const std::array<WaterPollutionSource, 1> disconnected{{ {0, 0, kDisconnectedWaterPollutionComponent, 4000}, }}; const WaterPollutionAdvance isolated = advance_water_pollution(initial, 0, disconnected, finite); CHECK(isolated.status == WaterPollutionAdvanceStatus::Advanced); CHECK(isolated.cells[0].treatedSourceUnits == 0); CHECK(isolated.cells[0].target == 1000); CHECK(isolated.cells[0].next == 916); CHECK(isolated.treatmentAllocations[0].unusedCapacityUnits == 5000);}
static void test_atomic_rejection() { const WaterPollutionState initial = state_for(4, 4); const std::array<WaterPollutionTreatment, 0> noTreatment{}; const std::array<WaterPollutionSource, 2> overflow{{ {0, 0, 0, std::numeric_limits<std::uint64_t>::max()}, {1, 1, 0, 1}, }}; WaterPollutionAdvance result = advance_water_pollution(initial, 0, overflow, noTreatment); CHECK(result.status == WaterPollutionAdvanceStatus::Overflow); CHECK(result.nextState == initial);
const std::array<WaterPollutionSource, 1> zeroSource{{{0, 0, 0, 0}}}; result = advance_water_pollution(initial, 0, zeroSource, noTreatment); CHECK(result.status == WaterPollutionAdvanceStatus::InvalidSource); CHECK(result.nextState == initial);
const std::array<WaterPollutionSource, 1> offMap{{{4, 0, 0, 1}}}; result = advance_water_pollution(initial, 0, offMap, noTreatment); CHECK(result.status == WaterPollutionAdvanceStatus::InvalidSource);
const std::array<WaterPollutionSource, 1> attributedReducer{{ {0, 0, 0, 1, WaterPollutionSourceKind::Reducer}, }}; result = advance_water_pollution( initial, 0, attributedReducer, noTreatment); CHECK(result.status == WaterPollutionAdvanceStatus::InvalidSource);
const std::array<WaterPollutionTreatment, 1> disconnected{{{-1, 1}}}; const std::array<WaterPollutionSource, 0> noSources{}; result = advance_water_pollution(initial, 0, noSources, disconnected); CHECK(result.status == WaterPollutionAdvanceStatus::InvalidTreatment); result = advance_water_pollution(initial, -1, noSources, noTreatment); CHECK(result.status == WaterPollutionAdvanceStatus::InvalidPeriod);
WaterPollutionState malformed = initial; malformed.cells.push_back(0); result = advance_water_pollution(malformed, 0, noSources, noTreatment); CHECK(result.status == WaterPollutionAdvanceStatus::InvalidState); CHECK(result.nextState == malformed);}
static void test_volume_weighted_exposure() { std::array<WaterDeliveryContribution, 3> contributions{{ {9, 2, 1000}, {8, 3, 2000}, {9, 4, 3000}, }}; const WaterExposureSummary summary = summarize_water_exposure(contributions); CHECK(summary.status == WaterExposureSummaryStatus::Summarized); CHECK(summary.city == (WaterExposure{20000, 9})); CHECK(water_exposure_mean(summary.city) == 2222); CHECK(summary.components.size() == 2); CHECK(summary.components[0] == (WaterComponentExposure{8, {6000, 3}})); CHECK(summary.components[1] == (WaterComponentExposure{9, {14000, 6}})); CHECK(water_exposure_mean(summary.components[1].exposure) == 2333);
std::reverse(contributions.begin(), contributions.end()); CHECK(summarize_water_exposure(contributions) == summary);
const std::array<WaterDeliveryContribution, 0> empty{}; const WaterExposureSummary noDelivery = summarize_water_exposure(empty); CHECK(noDelivery.status == WaterExposureSummaryStatus::Summarized); CHECK(noDelivery.city == WaterExposure{}); CHECK(!water_exposure_mean(noDelivery.city).has_value()); CHECK(!water_exposure_mean(WaterExposure{32768, 1}).has_value());
const std::array<WaterDeliveryContribution, 1> missing{{ WaterDeliveryContribution{}, }}; CHECK(summarize_water_exposure(missing).status == WaterExposureSummaryStatus::InvalidContribution); const std::array<WaterDeliveryContribution, 1> zero{{{1, 0, 0}}}; CHECK(summarize_water_exposure(zero).status == WaterExposureSummaryStatus::InvalidContribution); const std::array<WaterDeliveryContribution, 1> invalidValue{{ {1, 1, 32768}, }}; CHECK(summarize_water_exposure(invalidValue).status == WaterExposureSummaryStatus::InvalidContribution); const std::array<WaterDeliveryContribution, 1> overflow{{ {1, std::numeric_limits<std::uint64_t>::max(), 2}, }}; CHECK(summarize_water_exposure(overflow).status == WaterExposureSummaryStatus::Overflow);}
static void test_exposure_latch_exactly_once() { const WaterPollutionState initial = state_for(4, 4); const std::array<WaterPollutionSource, 0> noSources{}; const std::array<WaterPollutionTreatment, 0> noTreatment{}; const WaterPollutionAdvance field = advance_water_pollution(initial, 5, noSources, noTreatment); CHECK(field.status == WaterPollutionAdvanceStatus::Advanced);
const std::array<WaterDeliveryContribution, 3> contributions{{ {9, 2, 1000}, {8, 3, 2000}, {9, 4, 3000}, }}; const WaterExposureCommit committed = commit_water_exposure(field.nextState, 5, 12, contributions); CHECK(committed.status == WaterExposureCommitStatus::Committed); CHECK(committed.nextState.deliveredExposure == (WaterExposureLatch{5, 20000, 9, 3})); CHECK(committed.nextState.lastConsumedExposurePeriod == -1); CHECK(valid_water_pollution_state(committed.nextState));
const WaterExposureCommit duplicate = commit_water_exposure( committed.nextState, 5, 12, contributions); CHECK(duplicate.status == WaterExposureCommitStatus::AlreadyCommitted); CHECK(duplicate.nextState == committed.nextState); CHECK(duplicate.summary == committed.summary);
const WaterExposureCommit conflictingDemand = commit_water_exposure( committed.nextState, 5, 13, contributions); CHECK(conflictingDemand.status == WaterExposureCommitStatus::ConflictingCommit); CHECK(conflictingDemand.nextState == committed.nextState); auto conflictingContributions = contributions; ++conflictingContributions[0].contamination; const WaterExposureCommit conflictingExposure = commit_water_exposure( committed.nextState, 5, 12, conflictingContributions); CHECK(conflictingExposure.status == WaterExposureCommitStatus::ConflictingCommit); CHECK(conflictingExposure.nextState == committed.nextState); CHECK(commit_water_exposure( committed.nextState, 6, 12, contributions) .status == WaterExposureCommitStatus::PreviousExposureUnconsumed); CHECK(consume_water_exposure(committed.nextState, 4).status == WaterExposureConsumeStatus::WrongPeriod);
const WaterExposureConsumption consumed = consume_water_exposure(committed.nextState, 5); CHECK(consumed.status == WaterExposureConsumeStatus::Consumed); CHECK(consumed.exposure == committed.nextState.deliveredExposure); CHECK(consumed.nextState.lastConsumedExposurePeriod == 5); CHECK(consume_water_exposure(consumed.nextState, 5).status == WaterExposureConsumeStatus::AlreadyConsumed);
const WaterPollutionAdvance nextField = advance_water_pollution(consumed.nextState, 6, noSources, noTreatment); CHECK(nextField.status == WaterPollutionAdvanceStatus::Advanced); const std::array<WaterDeliveryContribution, 0> noDelivery{}; const WaterExposureCommit dry = commit_water_exposure(nextField.nextState, 6, 5, noDelivery); CHECK(dry.status == WaterExposureCommitStatus::Committed); CHECK(dry.nextState.deliveredExposure == (WaterExposureLatch{6, 0, 0, 5})); CHECK(dry.nextState.lastConsumedExposurePeriod == 5); CHECK(valid_water_pollution_state(dry.nextState));
const WaterExposureConsumption consumedDry = consume_water_exposure(dry.nextState, 6); CHECK(consumedDry.status == WaterExposureConsumeStatus::Consumed); CHECK(commit_water_exposure( consumedDry.nextState, 7, 0, noDelivery) .status == WaterExposureCommitStatus::FieldNotProcessed);
CHECK(commit_water_exposure(field.nextState, 5, 8, contributions).status == WaterExposureCommitStatus::InvalidDemand); const std::array<WaterDeliveryContribution, 1> missing{{ WaterDeliveryContribution{}, }}; CHECK(commit_water_exposure(field.nextState, 5, 8, missing).status == WaterExposureCommitStatus::InvalidContribution);}
static void test_exposure_state_validation_boundaries() { WaterPollutionState state = state_for(2, 2); state.lastProcessedPeriod = 0; state.deliveredExposure = {0, 65534, 2, 0}; CHECK(valid_water_pollution_state(state)); state.deliveredExposure.contaminationNumerator = 65535; CHECK(!valid_water_pollution_state(state)); state.deliveredExposure = {0, 1, 0, 0}; CHECK(!valid_water_pollution_state(state)); state.deliveredExposure = { 0, 0, std::numeric_limits<std::uint64_t>::max(), 1}; CHECK(!valid_water_pollution_state(state)); state.deliveredExposure = {1, 0, 0, 0}; CHECK(!valid_water_pollution_state(state)); state.deliveredExposure = {0, 0, 0, 0}; state.lastConsumedExposurePeriod = 1; CHECK(!valid_water_pollution_state(state));}
static void test_runtime_sanitizer_has_an_explicit_reset_boundary() { WaterPollutionState betweenPhases = state_for(4, 4); betweenPhases.lastProcessedPeriod = 0; betweenPhases.deliveredExposure = {0, 4000, 2, 1}; CHECK(valid_water_pollution_state(betweenPhases));
const auto preserved = sanitize_water_pollution_runtime_state( betweenPhases, 4, 4, 0, -1); CHECK(preserved.has_value()); CHECK(preserved && preserved->status == WaterPollutionRuntimeSanitization::Preserved); CHECK(preserved && preserved->state == betweenPhases);
const auto missedConsumption = sanitize_water_pollution_runtime_state( betweenPhases, 4, 4, 0, 0); CHECK(missedConsumption.has_value()); CHECK(missedConsumption && missedConsumption->status == WaterPollutionRuntimeSanitization::ResetTemporalOrder); CHECK(missedConsumption && missedConsumption->state.lastProcessedPeriod == 0); CHECK(missedConsumption && missedConsumption->state.deliveredExposure == WaterExposureLatch{}); CHECK(missedConsumption && missedConsumption->state.lastConsumedExposurePeriod == -1); CHECK(missedConsumption && std::all_of(missedConsumption->state.cells.begin(), missedConsumption->state.cells.end(), [](std::uint16_t value) { return value == 0; }));
WaterPollutionState afterHealth = betweenPhases; afterHealth.lastConsumedExposurePeriod = 0; const auto healthPreserved = sanitize_water_pollution_runtime_state( afterHealth, 4, 4, 0, 0); CHECK(healthPreserved && healthPreserved->status == WaterPollutionRuntimeSanitization::Preserved); const auto futureConsumption = sanitize_water_pollution_runtime_state( afterHealth, 4, 4, 0, -1); CHECK(futureConsumption && futureConsumption->status == WaterPollutionRuntimeSanitization::ResetTemporalOrder);
WaterPollutionState invalid = betweenPhases; invalid.cells.pop_back(); const auto invalidReset = sanitize_water_pollution_runtime_state( invalid, 4, 4, 0, -1); CHECK(invalidReset && invalidReset->status == WaterPollutionRuntimeSanitization::ResetInvalidState); CHECK(invalidReset && valid_water_pollution_state_for_extent(invalidReset->state, 4, 4));
const auto wrongExtent = sanitize_water_pollution_runtime_state( betweenPhases, 8, 8, 0, -1); CHECK(wrongExtent && wrongExtent->status == WaterPollutionRuntimeSanitization::ResetInvalidState); CHECK(wrongExtent && wrongExtent->state.cells.size() == 16); CHECK(!sanitize_water_pollution_runtime_state( betweenPhases, 4, 4, 0, 1)); CHECK(!sanitize_water_pollution_runtime_state( betweenPhases, 4, 4, 2, 0));}
int main() { test_constants_and_packed_compatibility(); test_geometry_accessors_and_validation(); test_response_and_pump_primitives(); test_atomic_component_local_update(); test_signed_reducers_precede_component_treatment(); test_decay_treatment_order_and_disconnection(); test_atomic_rejection(); test_volume_weighted_exposure(); test_exposure_latch_exactly_once(); test_exposure_state_validation_boundaries(); test_runtime_sanitizer_has_an_explicit_reset_boundary();
if (failures == 0) { std::printf("water pollution: all checks passed\n"); return 0; } std::printf("water pollution: %d failure(s)\n", failures); return 1;}