Esempio n. 1
0
 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;
     }
 }
Esempio n. 2
0
 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;
     }
 }
Esempio n. 3
0
bool solve(Exprs... exprs) {
  Generator gen;
  for (auto e : expression_list(exprs...)) gen(e);
  return gen.next();
}
Esempio n. 4
0
void generate(Generator& generator, std::vector<int>* out) {
  out->reserve(COUNT * 2);
  while (generator.hasNext()) {
    out->push_back(generator.next());
  }
}