LTP GCOV extension - code coverage report
Current view: | directory - ept/core - desktop.test.h
Test: | lcov.info
Date: | 2008-08-14 |  | Instrumented lines: | 33
Code covered: | 100.0 % |  | Executed lines: | 33

           1                 : // -*- C++ -*-
           2                 : #include <ept/config.h>
           3                 : #include <ept/core/desktop.h>
           4                 : #include <ept/core/list.h>
           5                 : #include <ept/test.h>
           6                 :
           7                 : using namespace ept::core;
           8                 :
           9               5 : struct TestDesktop {
          10                 :     desktop::Source desk;
          11                 :     ept::Token t;
          12                 :
          13               5 :     TestDesktop() : desk( TEST_ENV_DIR "desktop" ) {}
          14                 :
          15                 :     template< desktop::PropertyId P, typename L >
          16               3 :     void checkIteration2( int c, const char **check, L l ) {
          17               3 :         int i = 0;
          18              16 :         while ( !l.empty() ) {
          19              10 :             assert_eq( l.head().template get< P >(), check[ i ] );
          20              20 :             l = l.tail();
          21              10 :             ++ i;
          22                 :         }
          23               3 :         assert_eq( i, c );
          24               3 :     }
          25                 :
          26                 :     template< desktop::PropertyId P, typename L >
          27               3 :     void checkIteration( int c, const char **check, L l ) {
          28               3 :         checkIteration2< P >( c, check, list::sort( l ) );
          29               3 :     }
          30                 :
          31               1 :     Test iteration() {
          32               1 :         const char *check[] = { "Kdict", "foo", "XQF", "X-Server" };
          33                 :         checkIteration< desktop::Name >(
          34               1 :             4, check, desk.list< desktop::Name >() );
          35               1 :     }
          36                 :
          37               1 :     Test groupProperty() {
          38                 :         const char *check[] = {
          39                 :             "{ KDE, Qt, Utility }",
          40                 :             "{ KDE, Qt, Utility }",
          41                 :             "{ Application, Game, X-SuSE-Core-Game }",
          42                 :             "{ KDE, Qt, X-KDE-information }",
          43               1 :         };
          44                 :         checkIteration< desktop::Group >(
          45               1 :             4, check, desk.list< desktop::Name >() );
          46               1 :     }
          47                 :
          48               1 :     Test groups() {
          49               1 :         const char *check[] = { "Kdict", "foo" };
          50                 :         checkIteration< desktop::Name >(
          51               1 :             2, check, desk.group( "{ KDE, Qt, Utility }" ) );
          52               1 :     }
          53                 :
          54               1 :     Test groupList() {
          55                 :         std::string check[] = {
          56                 :             "{ Application, Game, X-SuSE-Core-Game }",
          57                 :             "{ KDE, Qt, Utility }",
          58                 :             "{ KDE, Qt, X-KDE-information }",
          59               1 :         };
          60                 :
          61               2 :         assert_list_eq( desk.groupList(), check );
          62               1 :     }
          63                 :
          64               1 :     Test emptyGroupList() {
          65               1 :         desktop::InternalList l;
          66               1 :         assert( l.empty() );
          67               1 :     }
          68                 : };

Generated by: LTP GCOV extension version 1.6