Author: adrian.chadd
Date: Wed Jul  8 15:49:14 2009
New Revision: 14162

Added:
    branches/LUSCA_HEAD/test-suite/libcore/
    branches/LUSCA_HEAD/test-suite/libcore/build   (contents, props changed)
    branches/LUSCA_HEAD/test-suite/libcore/test_libcore_1.c

Log:
Add in a very simple test case for uint64_percent()



Added: branches/LUSCA_HEAD/test-suite/libcore/build
==============================================================================
--- (empty file)
+++ branches/LUSCA_HEAD/test-suite/libcore/build        Wed Jul  8 15:49:14 2009
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+CFLAGS="-g -Wall -Werror -I../.."
+LDFLAGS="-L../../libcore"
+LIBS="-lcore -lm"
+
+rm test_libcore_1
+
+gcc ${CFLAGS}  test_libcore_1.c -o test_libcore_1 ${LDFLAGS} ${LIBS}
+
+./test_libcore_1

Added: branches/LUSCA_HEAD/test-suite/libcore/test_libcore_1.c
==============================================================================
--- (empty file)
+++ branches/LUSCA_HEAD/test-suite/libcore/test_libcore_1.c     Wed Jul  8  
15:49:14 2009
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <math.h>
+#include <fcntl.h>
+
+#include "libcore/tools.h"
+
+/*
+ * Test > 32 bit storedir size math for uint64_percent()
+ */
+static void
+test1a(void)
+{
+       uint64_t store_swap_size;
+       uint64_t maxSize;
+
+       maxSize = 2030043136;
+       store_swap_size = 1826533798;
+
+       /* Make well and truely sure the values are > 32 bit */
+       maxSize *= 4;
+       store_swap_size *= 4;
+
+       printf("MaxSize: %llu\n", maxSize);
+       printf("store_swap_size: %llu\n", store_swap_size);
+       printf("Current Capacity       : %d%% used, %d%% free\n",
+           (int) uint64_percent(store_swap_size, maxSize),
+           (int) uint64_percent((maxSize - store_swap_size), maxSize));
+}
+
+int
+main(int argc, const char *argv[])
+{
+       printf("%s: initializing\n", argv[0]);
+       test1a();
+       exit(0);
+}
+

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to