Debit reserve for proposed cellular motion
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Failing after 4m23s
Foundation / checks (network) (push) Failing after 3m5s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 32s
Foundation / checks (checks) (push) Canceled after 5m42s
Foundation / checks (postgres) (push) Canceled after 1m19s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (client) (push) Failing after 4m23s
Foundation / checks (network) (push) Failing after 3m5s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 32s
Foundation / checks (checks) (push) Canceled after 5m42s
Foundation / checks (postgres) (push) Canceled after 1m19s
This commit is contained in:
@@ -75,6 +75,31 @@ void edges_and_invalid_state() {
|
||||
CHECK(quantized->movement_cost.value == 0);
|
||||
}
|
||||
|
||||
void movement_funding_is_one_candidate() {
|
||||
using evo::accounting::Inventory;
|
||||
const Inventory reserve{{100}, {{{1}, {2}, {3}, {4}}}};
|
||||
const Inventory heat{{7}, {{{5}, {6}, {7}, {8}}}};
|
||||
const auto funded = propose_funded_cellular_motion({400, 300}, {100, 100}, 20, {1000, 0},
|
||||
budget(), reserve, heat);
|
||||
CHECK(funded && funded->position == CellularPosition{110, 100});
|
||||
CHECK(funded->movement_cost.value == 50);
|
||||
CHECK(funded->reserve_after == Inventory{{50}, {{{1}, {2}, {3}, {4}}}});
|
||||
CHECK(funded->heat_after == Inventory{{57}, {{{5}, {6}, {7}, {8}}}});
|
||||
|
||||
auto poor = reserve;
|
||||
poor.energy.value = 49;
|
||||
const auto refused =
|
||||
propose_funded_cellular_motion({400, 300}, {100, 100}, 20, {1000, 0}, budget(), poor, heat);
|
||||
CHECK(!refused && refused.error() == CellularMotionError::insufficient_reserve);
|
||||
CHECK(poor.energy.value == 49 && heat.energy.value == 7);
|
||||
|
||||
auto full_heat = heat;
|
||||
full_heat.energy.value = UINT64_MAX;
|
||||
const auto overflow = propose_funded_cellular_motion({400, 300}, {100, 100}, 20, {1000, 0},
|
||||
budget(), reserve, full_heat);
|
||||
CHECK(!overflow && overflow.error() == CellularMotionError::overflow);
|
||||
}
|
||||
|
||||
void contact_geometry() {
|
||||
CHECK(cellular_footprints_contact({0, 0}, 20, {20, 0}, 20)); // Exact edge touch.
|
||||
CHECK(cellular_footprints_contact({0, 0}, 20, {19, 19}, 20));
|
||||
@@ -88,6 +113,7 @@ int main() {
|
||||
try {
|
||||
movement_proposals();
|
||||
edges_and_invalid_state();
|
||||
movement_funding_is_one_candidate();
|
||||
contact_geometry();
|
||||
std::puts("PASS cellular motion: phenotype speed, energy cost, bounds and contact");
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
Reference in New Issue
Block a user