-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseqread_test.cpp
34 lines (28 loc) · 889 Bytes
/
seqread_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define BOOST_TEST_MODULE seqread
#include <boost/test/included/unit_test.hpp>
#include <string>
#include <filesystem>
#include <chrono>
#include "database.h"
#include "./test_helpers.h"
static const int nr = 1000000;
static const std::string dbname = "testdb/mydb";
static void _testRead() {
auto db = Database::open(dbname,Options());
auto start = std::chrono::system_clock::now();
auto itr = db->lookup("","");
int count = 0;
KeyValue kv;
while(!(itr->next(kv).key.empty())) count++;
if(count!=nr) {
std::cout << "count is " << count << "\n";
throw IllegalState("incorrect count");
}
auto end = std::chrono::system_clock::now();
auto ms = millis(end,start);
std::cout << "read seq time " << ms << " ms, us per op " << (ms*1000)/(double)nr << "\n";
db->close();
}
BOOST_AUTO_TEST_CASE( seqread ) {
_testRead();
}