libept  0.5.25
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 
9 {
12 
13  TestAptRecord() : recs( db ) {
14  t._id = "sp";
15  }
16 
17  Test checkLookup() {
18  recs.get< record::Record >( t );
19  }
20 
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 
28  assert_eq( recs.get< record::InstalledSize >( t ),
29  600 );
30  }
31 
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 };
Test checkLookupValue()
Definition: record.test.h:21
Definition: test.h:10
ept::Token t
Definition: record.test.h:11
Test checkList()
Definition: record.test.h:45
Test nonexistent()
Definition: record.test.h:52
Definition: action.h:12
Test checkLookup()
Definition: record.test.h:17
Test checkLookupNumeric()
Definition: record.test.h:27
Test checkShortDescription()
Definition: record.test.h:32
Definition: core/apt.h:387
std::string package() const
Definition: token.h:22
Definition: core/apt.h:389
Definition: token.h:10
PType< property >::T get(Token t)
Definition: source.h:23
void checkRecordNameList(List l)
Definition: record.test.h:38
std::string _id
Definition: token.h:11
Definition: core/apt.h:387
Definition: record.test.h:8
TestAptRecord()
Definition: record.test.h:13
Definition: record.h:135
Definition: core/apt.h:387
ComposedList< property > list()
Definition: source.h:80
record::Source recs
Definition: record.test.h:10
Definition: core/apt.h:387