]> git.saurik.com Git - wxWidgets.git/commitdiff
more tests: OS/user info functions
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 17 Mar 2000 23:02:38 +0000 (23:02 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 17 Mar 2000 23:02:38 +0000 (23:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/console/console.cpp

index 7f639229de7371a58af4bddc09bccf126ea5f1d4..b922cec0aef35e8b9a21c79d10e5bd1d205dbc70 100644 (file)
@@ -45,7 +45,8 @@
 //#define TEST_LOG
 //#define TEST_LONGLONG
 //#define TEST_MIME
-#define TEST_SOCKETS
+#define TEST_INFO_FUNCTIONS
+//#define TEST_SOCKETS
 //#define TEST_STRINGS
 //#define TEST_THREADS
 //#define TEST_TIMER
@@ -456,6 +457,41 @@ static void TestMimeEnum()
 
 #endif // TEST_MIME
 
+// ----------------------------------------------------------------------------
+// misc information functions
+// ----------------------------------------------------------------------------
+
+#ifdef TEST_INFO_FUNCTIONS
+
+#include <wx/utils.h>
+
+static void TestOsInfo()
+{
+    puts("*** Testing OS info functions ***\n");
+
+    int major, minor;
+    wxGetOsVersion(&major, &minor);
+    printf("Running under: %s, version %d.%d\n",
+            wxGetOsDescription().c_str(), major, minor);
+
+    printf("%d free bytes of memory left.\n", wxGetFreeMemory());
+
+    printf("Host name is %s (%s).\n",
+           wxGetHostName().c_str(), wxGetFullHostName().c_str());
+}
+
+static void TestUserInfo()
+{
+    puts("*** Testing user info functions ***\n");
+
+    printf("User id is:\t%s\n", wxGetUserId().c_str());
+    printf("User name is:\t%s\n", wxGetUserName().c_str());
+    printf("Home dir is:\t%s\n", wxGetHomeDir().c_str());
+    printf("Email address:\t%s\n", wxGetEmailAddress().c_str());
+}
+
+#endif // TEST_INFO_FUNCTIONS
+
 // ----------------------------------------------------------------------------
 // long long
 // ----------------------------------------------------------------------------
@@ -2622,6 +2658,11 @@ int main(int argc, char **argv)
     TestMimeEnum();
 #endif // TEST_MIME
 
+#ifdef TEST_INFO_FUNCTIONS
+    TestOsInfo();
+    TestUserInfo();
+#endif // TEST_INFO_FUNCTIONS
+
 #ifdef TEST_SOCKETS
     if ( 1 )
         TestSocketServer();