87
87
Database_Navigation database;
88
88
database.create ();
89
89
// Use current time.
90
int time = filter_date_seconds_since_epoch ();
90
int time = filter::date::seconds_since_epoch ();
91
91
// Record one entry, and another one 6 seconds later.
92
92
database.record (time, user, 1, 2, 3);
94
94
database.record (time, user, 4, 5, 6);
95
95
// Get previous entry, which should be the first one entered.
96
96
Passage passage = database.get_previous (user);
97
evaluate (__LINE__, __func__, 1, passage.book);
98
evaluate (__LINE__, __func__, 2, passage.chapter);
99
evaluate (__LINE__, __func__, "3", passage.verse);
97
evaluate (__LINE__, __func__, 1, passage.m_book);
98
evaluate (__LINE__, __func__, 2, passage.m_chapter);
99
evaluate (__LINE__, __func__, "3", passage.m_verse);
104
104
Database_Navigation database;
105
105
database.create ();
106
106
// Use current time.
107
int time = filter_date_seconds_since_epoch ();
107
int time = filter::date::seconds_since_epoch ();
108
108
// Record one entry, and another 6 seconds later.
109
109
database.record (time, user, 1, 2, 3);
111
111
database.record (time, user, 4, 5, 6);
112
112
// Get previous entry for another user: It should not be there.
113
113
Passage passage = database.get_previous (user + "2");
114
evaluate (__LINE__, __func__, 0, passage.book);
115
evaluate (__LINE__, __func__, 0, passage.chapter);
116
evaluate (__LINE__, __func__, "", passage.verse);
114
evaluate (__LINE__, __func__, 0, passage.m_book);
115
evaluate (__LINE__, __func__, 0, passage.m_chapter);
116
evaluate (__LINE__, __func__, "", passage.m_verse);
196
196
Database_Navigation database;
197
197
database.create ();
198
198
// Record two entries at an interval.
199
int time = filter_date_seconds_since_epoch ();
199
int time = filter::date::seconds_since_epoch ();
200
200
database.record (time, user, 1, 2, 3);
202
202
database.record (time, user, 4, 5, 6);
203
203
// Next entry is not there.
204
204
Passage passage = database.get_next (user);
205
evaluate (__LINE__, __func__, 0, passage.book);
206
evaluate (__LINE__, __func__, 0, passage.chapter);
207
evaluate (__LINE__, __func__, "", passage.verse);
205
evaluate (__LINE__, __func__, 0, passage.m_book);
206
evaluate (__LINE__, __func__, 0, passage.m_chapter);
207
evaluate (__LINE__, __func__, "", passage.m_verse);
208
208
// Previous entry should be there.
209
209
passage = database.get_previous (user);
210
evaluate (__LINE__, __func__, 1, passage.book);
211
evaluate (__LINE__, __func__, 2, passage.chapter);
212
evaluate (__LINE__, __func__, "3", passage.verse);
210
evaluate (__LINE__, __func__, 1, passage.m_book);
211
evaluate (__LINE__, __func__, 2, passage.m_chapter);
212
evaluate (__LINE__, __func__, "3", passage.m_verse);
213
213
// Next entry should be there since we moved to the previous one.
214
214
passage = database.get_next (user);
215
evaluate (__LINE__, __func__, 4, passage.book);
216
evaluate (__LINE__, __func__, 5, passage.chapter);
217
evaluate (__LINE__, __func__, "6", passage.verse);
215
evaluate (__LINE__, __func__, 4, passage.m_book);
216
evaluate (__LINE__, __func__, 5, passage.m_chapter);
217
evaluate (__LINE__, __func__, "6", passage.m_verse);
218
218
// Previous entry should be there.
219
219
passage = database.get_previous (user);
220
evaluate (__LINE__, __func__, 1, passage.book);
221
evaluate (__LINE__, __func__, 2, passage.chapter);
222
evaluate (__LINE__, __func__, "3", passage.verse);
220
evaluate (__LINE__, __func__, 1, passage.m_book);
221
evaluate (__LINE__, __func__, 2, passage.m_chapter);
222
evaluate (__LINE__, __func__, "3", passage.m_verse);
223
223
// Previous entry before previous entry should not be there.
224
224
passage = database.get_previous (user);
225
evaluate (__LINE__, __func__, 0, passage.book);
226
evaluate (__LINE__, __func__, 0, passage.chapter);
227
evaluate (__LINE__, __func__, "", passage.verse);
225
evaluate (__LINE__, __func__, 0, passage.m_book);
226
evaluate (__LINE__, __func__, 0, passage.m_chapter);
227
evaluate (__LINE__, __func__, "", passage.m_verse);
228
228
// Next entry should be there since we moved to the previous one.
229
229
passage = database.get_next (user);
230
evaluate (__LINE__, __func__, 4, passage.book);
231
evaluate (__LINE__, __func__, 5, passage.chapter);
232
evaluate (__LINE__, __func__, "6", passage.verse);
230
evaluate (__LINE__, __func__, 4, passage.m_book);
231
evaluate (__LINE__, __func__, 5, passage.m_chapter);
232
evaluate (__LINE__, __func__, "6", passage.m_verse);
233
233
// The entry next to the next entry should not be there.
234
234
passage = database.get_next (user);
235
evaluate (__LINE__, __func__, 0, passage.book);
236
evaluate (__LINE__, __func__, 0, passage.chapter);
237
evaluate (__LINE__, __func__, "", passage.verse);
235
evaluate (__LINE__, __func__, 0, passage.m_book);
236
evaluate (__LINE__, __func__, 0, passage.m_chapter);
237
evaluate (__LINE__, __func__, "", passage.m_verse);
262
262
passages = database.get_history(user, -1);
263
263
evaluate (__LINE__, __func__, 2, passages.size());
264
264
if (passages.size() == 2) {
265
evaluate (__LINE__, __func__, 4, passages[0].book);
266
evaluate (__LINE__, __func__, 5, passages[0].chapter);
267
evaluate (__LINE__, __func__, "6", passages[0].verse);
268
evaluate (__LINE__, __func__, 1, passages[1].book);
269
evaluate (__LINE__, __func__, 2, passages[1].chapter);
270
evaluate (__LINE__, __func__, "3", passages[1].verse);
265
evaluate (__LINE__, __func__, 4, passages[0].m_book);
266
evaluate (__LINE__, __func__, 5, passages[0].m_chapter);
267
evaluate (__LINE__, __func__, "6", passages[0].m_verse);
268
evaluate (__LINE__, __func__, 1, passages[1].m_book);
269
evaluate (__LINE__, __func__, 2, passages[1].m_chapter);
270
evaluate (__LINE__, __func__, "3", passages[1].m_verse);
273
273
// At this stage there should not yet be any forward history.
281
281
passages = database.get_history(user, -1);
282
282
evaluate (__LINE__, __func__, 1, passages.size());
283
283
if (passages.size() == 1) {
284
evaluate (__LINE__, __func__, 1, passages[0].book);
285
evaluate (__LINE__, __func__, 2, passages[0].chapter);
286
evaluate (__LINE__, __func__, "3", passages[0].verse);
284
evaluate (__LINE__, __func__, 1, passages[0].m_book);
285
evaluate (__LINE__, __func__, 2, passages[0].m_chapter);
286
evaluate (__LINE__, __func__, "3", passages[0].m_verse);
288
288
passages = database.get_history(user, 1);
289
289
evaluate (__LINE__, __func__, 1, passages.size());
290
290
if (passages.size() == 1) {
291
evaluate (__LINE__, __func__, 7, passages[0].book);
292
evaluate (__LINE__, __func__, 8, passages[0].chapter);
293
evaluate (__LINE__, __func__, "9", passages[0].verse);
291
evaluate (__LINE__, __func__, 7, passages[0].m_book);
292
evaluate (__LINE__, __func__, 8, passages[0].m_chapter);
293
evaluate (__LINE__, __func__, "9", passages[0].m_verse);
296
296
// Go backwards yet another step.
304
304
passages = database.get_history(user, 1);
305
305
evaluate (__LINE__, __func__, 2, passages.size());
306
306
if (passages.size() == 2) {
307
evaluate (__LINE__, __func__, 4, passages[0].book);
308
evaluate (__LINE__, __func__, 5, passages[0].chapter);
309
evaluate (__LINE__, __func__, "6", passages[0].verse);
310
evaluate (__LINE__, __func__, 7, passages[1].book);
311
evaluate (__LINE__, __func__, 8, passages[1].chapter);
312
evaluate (__LINE__, __func__, "9", passages[1].verse);
307
evaluate (__LINE__, __func__, 4, passages[0].m_book);
308
evaluate (__LINE__, __func__, 5, passages[0].m_chapter);
309
evaluate (__LINE__, __func__, "6", passages[0].m_verse);
310
evaluate (__LINE__, __func__, 7, passages[1].m_book);
311
evaluate (__LINE__, __func__, 8, passages[1].m_chapter);
312
evaluate (__LINE__, __func__, "9", passages[1].m_verse);