libept
0.5.25
Main Page
Namespaces
Classes
Files
File List
File Members
ept
core
apt
record.test.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
#include <
ept/core/apt.h
>
3
4
#include <
ept/test.h
>
5
6
using namespace
ept::core;
7
8
struct
TestAptRecord
:
AptTestEnvironment
9
{
10
record::Source
recs
;
11
ept::Token
t
;
12
13
TestAptRecord
() : recs( db ) {
14
t._id =
"sp"
;
15
}
16
17
Test
checkLookup
() {
18
recs.get<
record::Record
>( t );
19
}
20
21
Test
checkLookupValue
() {
22
assert_eq( recs.get<
record::Name
>( t ), t.package() );
23
assert_eq( recs.get<
record::Maintainer
>( t ),
24
"Neil Roeth <neil@debian.org>"
);
25
}
26
27
Test
checkLookupNumeric
() {
28
assert_eq( recs.get<
record::InstalledSize
>( t ),
29
600 );
30
}
31
32
Test
checkShortDescription
() {
33
assert_eq( recs.get<
record::ShortDescription
>( t ),
34
"James Clark's SGML parsing tools"
);
35
}
36
37
template
<
typename
List >
38
void
checkRecordNameList
( List l ) {
39
while
( !l.empty() ) {
40
assert_eq( l.property(), l.token().package() );
41
l = l.tail();
42
}
43
}
44
45
Test
checkList
() {
46
// there are 435 valid records in the list file
47
assert_eq( list::count( recs.list<
48
record::Name
>() ), 435 );
49
checkRecordNameList( recs.list<
record::Name
>() );
50
}
51
52
Test
nonexistent
() {
53
assert_eq( recs.get<
record::ShortDescription
>(
54
ept::Token
(
"nonexistent-package"
) ),
""
);
55
}
56
};
Generated on Fri Aug 19 2016 02:30:05 for libept by
1.8.1.2