void assertPageRegionMatches(page_count_t page, page_size_t offset, page_size_t end, Generator& gen) { uint8_t buf[128]; flash_addr_t base = flash->pageAddress(page); while (offset<end) { page_size_t toRead = min(page_size_t(sizeof(buf)), end-offset); assertTrue(flash->readPage(buf, base+offset, toRead)); for (page_size_t i=0; i<toRead; i++) { assertEqual(buf[i],gen.next()); } offset += toRead; } }
void fillPageRegion(page_count_t page, page_size_t offset, page_size_t end, Generator& gen) { uint8_t buf[128]; flash_addr_t base = flash->pageAddress(page); while (offset<end) { page_size_t toRead = min(page_size_t(sizeof(buf)), end-offset); for (page_size_t i=0; i<toRead; i++) { buf[i] = gen.next(); } assertTrue(flash->writePage(buf, base+offset, toRead)); offset += toRead; } }
bool solve(Exprs... exprs) { Generator gen; for (auto e : expression_list(exprs...)) gen(e); return gen.next(); }
void generate(Generator& generator, std::vector<int>* out) { out->reserve(COUNT * 2); while (generator.hasNext()) { out->push_back(generator.next()); } }