}
// Add the final state
- edges.push_back(pair<int64_t, bool>(end,
- get_sample(end) & sig_mask));
+ const bool end_sample = get_sample(end) & sig_mask;
+ if (last_sample != end_sample)
+ edges.push_back(pair<int64_t, bool>(end, end_sample));
+ edges.push_back(pair<int64_t, bool>(end + 1, end_sample));
}
uint64_t LogicSnapshot::get_subsample(int level, uint64_t offset) const
BOOST_CHECK_EQUAL(edges[0].first, 0);
BOOST_CHECK_EQUAL(edges[1].first, 8);
BOOST_CHECK_EQUAL(edges[2].first, 16);
- BOOST_CHECK_EQUAL(edges[3].first, 255);
+ BOOST_CHECK_EQUAL(edges[3].first, 256);
// Test a subset at high zoom
edges.clear();
BOOST_CHECK_EQUAL(edges[0].first, 6);
BOOST_CHECK_EQUAL(edges[1].first, 8);
BOOST_CHECK_EQUAL(edges[2].first, 16);
- BOOST_CHECK_EQUAL(edges[3].first, 17);
+ BOOST_CHECK_EQUAL(edges[3].first, 18);
}
BOOST_AUTO_TEST_CASE(LargeData)
BOOST_CHECK_EQUAL(edges[i].second, i & 1);
}
- BOOST_CHECK_EQUAL(edges[31].first, 999999);
+ BOOST_CHECK_EQUAL(edges[31].first, 1000000);
// Check in very low zoom case
edges.clear();
BOOST_CHECK_EQUAL(edges[i*2+1].second, false);
}
- BOOST_CHECK_EQUAL(edges.back().first, Length-1);
+ BOOST_CHECK_EQUAL(edges.back().first, Length);
BOOST_CHECK_EQUAL(edges.back().second, false);
//----- Test get_subsampled_edges at a simplified scale -----//
BOOST_CHECK_EQUAL(edges[i+1].second, false);
}
- BOOST_CHECK_EQUAL(edges.back().first, Length-1);
+ BOOST_CHECK_EQUAL(edges.back().first, Length);
BOOST_CHECK_EQUAL(edges.back().second, false);
}