direct-input/test/test.cpp

Go to the documentation of this file.
00001 /*
00002  * test.cpp
00003  *
00004  * Copyright (C) 2010  Thomas A. Vaughan
00005  * All rights reserved.
00006  *
00007  * Test of the DirectInput source device
00008  */
00009 
00010 // includes --------------------------------------------------------------------
00011 #include <iostream>
00012 #include <time.h>
00013 
00014 #include "common/common.h"
00015 #include "direct-input/direct-input.h"
00016 #include "perf/perf.h"
00017 #include "source-device/sd-test.h"
00018 #include "util/file.h"
00019 #include "wave-windows/wave-windows.h"
00020 
00021 
00022 ////////////////////////////////////////////////////////////////////////////////
00023 //
00024 //      static helper methods
00025 //
00026 ////////////////////////////////////////////////////////////////////////////////
00027 
00028 static void
00029 doTest
00030 (
00031 void
00032 )
00033 {
00034         smart_ptr<gamepad::SourceDeviceFactory> factory =
00035             gamepad::getDirectInputSourceDeviceFactory();
00036         ASSERT(factory,
00037             "failed to retrieve direct input source device factory");
00038 
00039         DPRINTF("Created source device factory!");
00040         DPRINTF("  name: '%s'", factory->getName());
00041 
00042         gamepad::testSourceDeviceFactory(factory);
00043 }
00044 
00045 
00046 
00047 ////////////////////////////////////////////////////////////////////////////////
00048 //
00049 //      entry point
00050 //
00051 ////////////////////////////////////////////////////////////////////////////////
00052 
00053 int
00054 main
00055 (
00056 IN int argc,
00057 IN const char * argv[]
00058 )
00059 {
00060 
00061         int retval = 0;
00062         try {
00063                 perf::Timer timer("overall timer");
00064 
00065                 doTest();
00066 
00067         } catch (std::exception& e) {
00068                 DPRINTF("EXCEPTION: %s", e.what());
00069                 retval = 1;
00070         }
00071 
00072         perf::dumpTimingSummary(std::cerr);
00073 
00074         return retval;
00075 }
00076