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

action.test.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include <ept/core/apt/action.h>
00003 #include <ept/test.h>
00004 
00005 using namespace ept::core;
00006 
00007 struct TestAptAction : AptTestEnvironment
00008 {
00009     package::Source pkgs;
00010     TestAptAction() : pkgs( db ) {}
00011 
00012     Test basic() {
00013         ept::Token t( "sp" );
00014         package::Action a( t, package::Action::Install );
00015         a.apply( pkgs );
00016         assert( pkgs.get< package::State >( t ).install() );
00017         a = package::Action( t, package::Action::Keep );
00018         a.apply( pkgs );
00019         assert( pkgs.get< package::State >( t ).keep() );
00020     }
00021 
00022     Test revert() {
00023         ept::Token t( "sp" );
00024         package::Action a( t, package::Action::Install );
00025         a.apply( pkgs );
00026         assert( pkgs.get< package::State >( t ).install() );
00027         pkgs.revertStates();
00028         assert( pkgs.get< package::State >( t ).keep() );
00029     }
00030 
00031     Test keep() {
00032         package::ActionList al;
00033         ept::Token t( "sp" );
00034         al.add( package::Action( t, package::Action::Install ) );
00035         assert( !al.empty() );
00036         al.add( package::Action( t, package::Action::Remove ) );
00037         al.add( package::Action( t, package::Action::Keep ) );
00038         al.replay( pkgs );
00039         assert( pkgs.get< package::State >( t ).keep() );
00040     }
00041 };

Generated on Fri Aug 19 2016 15:16:55 for libept by  doxygen 1.7.1