aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-08-18 17:16:22 +0000
committerJim Laskey <jlaskey@mac.com>2005-08-18 17:16:22 +0000
commit064613d19aac72a5bf8fade45f0a656559dedd99 (patch)
tree1f9070f15d47f03d2a72dab4ed673388af0b0998
parentd6be66366d5eed154216c7aff772d078db4f0588 (diff)
Adding edge case tests for int to fp casting.
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@22860 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--SingleSource/UnitTests/2005-07-17-INT-To-FP.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/SingleSource/UnitTests/2005-07-17-INT-To-FP.c b/SingleSource/UnitTests/2005-07-17-INT-To-FP.c
index 4e16cc6b..7b007a9b 100644
--- a/SingleSource/UnitTests/2005-07-17-INT-To-FP.c
+++ b/SingleSource/UnitTests/2005-07-17-INT-To-FP.c
@@ -1,8 +1,24 @@
// Test the various SINT-TO-FP and UINT-TO-FP conversions.
#include <stdio.h>
+int tests[] = {
+ 0x80000000,
+ -123456789,
+ -10,
+ -2,
+ -1,
+ 0,
+ 1,
+ 2,
+ 10,
+ 123456789,
+ 0x7FFFFFFF
+};
+
int main() {
+
unsigned i;
+ // byte boundary tests
for (i = 0; i < 64; ++i) {
printf("%d %f, %f, %f, %f\n", i,
(double)(signed char)(i << 2), // i8
@@ -16,4 +32,11 @@ int main() {
(double)(unsigned int)(i << 26), // i32
(double)(unsigned long long)((unsigned long long)i << 58ULL)); // i64
}
+ // edge case tests
+ for (unsigned i = 0; i < (sizeof(tests) / sizeof(int)); i++) {
+ printf("%d %f %f %f %f\n", (double)(unsigned)tests[i],
+ (double)( signed)tests[i],
+ (float) (unsigned)tests[i],
+ (float) ( signed)tests[i]);
+ }
}