summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/limits.stp
diff options
context:
space:
mode:
authorhunt <hunt>2007-09-13 13:21:37 +0000
committerhunt <hunt>2007-09-13 13:21:37 +0000
commita404007ed22eaad61f3793e932a70d6c7f06e2d4 (patch)
tree36cacec5fb9401b07235294e0af635815e17133d /testsuite/systemtap.base/limits.stp
parent4fcb43930fe506ea7837e958f2613a22e9f647a2 (diff)
downloadsystemtap-steved-a404007ed22eaad61f3793e932a70d6c7f06e2d4.tar.gz
systemtap-steved-a404007ed22eaad61f3793e932a70d6c7f06e2d4.tar.xz
systemtap-steved-a404007ed22eaad61f3793e932a70d6c7f06e2d4.zip
2007-09-13 Martin Hunt <hunt@redhat.com>
* systemtap.base/limits.exp: New. Test 32 and 64-bit integer extremes.
Diffstat (limited to 'testsuite/systemtap.base/limits.stp')
-rw-r--r--testsuite/systemtap.base/limits.stp51
1 files changed, 51 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/limits.stp b/testsuite/systemtap.base/limits.stp
new file mode 100644
index 00000000..ee929d4b
--- /dev/null
+++ b/testsuite/systemtap.base/limits.stp
@@ -0,0 +1,51 @@
+# test integer limits. Set and print variables and print constants.
+
+probe begin {
+
+
+ long_max = 2147483647;
+ ulong_max = 4294967295;
+ long_min = -2147483647-1;
+ long_min2 = -2147483648;
+
+ printf("Maximum signed 32-bit number\n")
+ printf("%d 0x%x\n", long_max, long_max)
+ printf("%d 0x%x\n", 2147483647, 2147483647)
+ printf("%d 0x%x\n", 0x7fffffff, 0x7fffffff)
+
+ printf("\nMaximum unsigned 32-bit number\n")
+ printf("%d 0x%x\n", ulong_max, ulong_max)
+ printf("%d 0x%x\n", 4294967295, 4294967295)
+ printf("%d 0x%x\n", 0xffffffff, 0xffffffff)
+
+ printf("\nMinimum signed 32-bit number\n")
+ printf("%d 0x%x\n", long_min, long_min)
+ printf("%d 0x%x\n", long_min2, long_min2)
+ printf("%d 0x%x\n", -2147483648, -2147483648)
+ printf("%d 0x%x\n", 0xffffffff80000000, 0xffffffff80000000)
+
+ llong_max = 9223372036854775807;
+ ullong_max = 18446744073709551615;
+ llong_min = -9223372036854775807-1;
+ llong_min2 = -9223372036854775808;
+ llong_min3 = 9223372036854775808;
+
+ printf("\nMaximum signed 64-bit number\n")
+ printf("%d 0x%x\n", llong_max, llong_max)
+ printf("%d 0x%x\n", 9223372036854775807, 9223372036854775807)
+ printf("%d 0x%x\n", 0x7fffffffffffffff, 0x7fffffffffffffff)
+
+ printf("\nMaximum unsigned 64-bit number\n")
+ printf("%ud 0x%x\n", ullong_max, ullong_max)
+ printf("%ud 0x%x\n", 18446744073709551615, 18446744073709551615)
+ printf("%ud 0x%x\n", 0xffffffffffffffff, 0xffffffffffffffff)
+
+ printf("\nMinimum signed 64-bit number\n")
+ printf("%d 0x%x\n", llong_min, llong_min)
+ printf("%d 0x%x\n", llong_min2, llong_min2)
+ printf("%d 0x%x\n", llong_min3, llong_min3)
+ printf("%d 0x%x\n", -9223372036854775808, -9223372036854775808)
+ printf("%d 0x%x\n", 0x8000000000000000, 0x8000000000000000)
+
+ exit()
+}