#include #include "DemoAndLicensing.h" int main( int argc, char *argv[] ) { CERT::DemoAndLicensing *demo = CERT::DemoAndLicensing::sharedDemo(); // override the built-in paths, so we don't stomp on a real installation std::vector paths; // paths.push_back("/Library"); paths.push_back("/tmp/lic1"); // paths.push_back("~/Temp"); paths.push_back("/tmp/lic2"); demo->setAllowedPaths( paths ); demo->setFilename( "demotest" ); // Remove any existing files and/or directories // create directories in all locations // try starting a demo // remove one of the directories and retry starting. Make sure it used the correct path // It would be good if we could write arbitrary dates to one of the files then test starting a demo // A far future date // Tomorrow // Today // 1, 29, 30 and 31 days ago // A very early date (years ago) if( demo->isDemo() ) { std::cout << "Demo!" << std::endl; if( demo->hasDemoEnded() ) std::cout << " Demo ended on " << demo->demoEndDate() << std::endl; else demo->notifyUserDemoLeft(); } else { if( demo->hasDemoEnded() ) { std::cout << "Not Demo?" << std::endl; demo->notifyUserDemoEnded(); } else if( !demo->startDemo() ) { std::cout << "Unable to start demo." << std::endl; demo->notifyUserDemoNotAllowed(); } else { demo->notifyUserDemoLeft(); } } return 0; }