• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

record.test.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include <ept/core/apt.h>
00003 
00004 #include <ept/test.h>
00005 
00006 using namespace ept::core;
00007 
00008 struct TestAptRecord : AptTestEnvironment
00009 {
00010     record::Source recs;
00011     ept::Token t;
00012 
00013     TestAptRecord() : recs( db ) {
00014         t._id = "sp";
00015     }
00016 
00017     Test checkLookup() {
00018         recs.get< record::Record >( t );
00019     }
00020 
00021     Test checkLookupValue() {
00022         assert_eq( recs.get< record::Name >( t ), t.package() );
00023         assert_eq( recs.get< record::Maintainer >( t ),
00024                    "Neil Roeth <neil@debian.org>" );
00025     }
00026 
00027     Test checkLookupNumeric() {
00028         assert_eq( recs.get< record::InstalledSize >( t ),
00029                    600 );
00030     }
00031 
00032     Test checkShortDescription() {
00033         assert_eq( recs.get< record::ShortDescription >( t ),
00034                    "James Clark's SGML parsing tools" );
00035     }
00036 
00037     template< typename List >
00038     void checkRecordNameList( List l ) {
00039         while ( !l.empty() ) {
00040             assert_eq( l.property(), l.token().package() );
00041             l = l.tail();
00042         }
00043     }
00044 
00045     Test checkList() {
00046         // there are 435 valid records in the list file
00047         assert_eq( list::count( recs.list<
00048                                 record::Name >() ), 435 );
00049         checkRecordNameList( recs.list< record::Name >() );
00050     }
00051 
00052     Test nonexistent() {
00053         assert_eq( recs.get< record::ShortDescription >(
00054                        ept::Token( "nonexistent-package" ) ), "" );
00055     }
00056 };

Generated on Fri Aug 19 2016 15:05:45 for libept by  doxygen 1.7.1