diff options
Diffstat (limited to 'test/Unit/ipow.cpp')
-rw-r--r-- | test/Unit/ipow.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Unit/ipow.cpp b/test/Unit/ipow.cpp new file mode 100644 index 0000000..0956bb2 --- /dev/null +++ b/test/Unit/ipow.cpp @@ -0,0 +1,38 @@ +//===-- ipow.cpp - Test libflang_pow_i*_i* --------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <assert.h> +#include <iostream> +#include "Numerical/Integer.h" + +bool testPowI4(int32_t x, int32_t y, int32_t expected) { + x = libflang_pow_i4_i4(x, y); + if(x != expected) + std::cout << "Error in libflang_pow_i4_i4 - expected " << expected + << ", got " << x << std::endl; + return x != expected; +} + +int main() { + if(testPowI4(2,2,4)) + return 1; + if(testPowI4(3,3,27)) + return 1; + if(testPowI4(4,1,4)) + return 1; + if(testPowI4(5,0,1)) + return 1; + if(testPowI4(6,-1,0)) + return 1; + if(testPowI4(-1,2,1)) + return 1; + if(testPowI4(-1,-1,0)) + return 1; + return 0; +} |