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 };