testtokenize:simplifyFloatCasts(): Added testcases for double and long double.

This commit is contained in:
orbitcowboy 2013-11-17 08:44:05 -08:00
parent 27a40b10e1
commit 1798fc3645
1 changed files with 9 additions and 0 deletions

View File

@ -1126,9 +1126,18 @@ private:
}
void simplifyFloatCasts() { // float casting integers
// C-style casts
ASSERT_EQUALS("a = 1.0 ;", tokenizeAndStringify("a = (float)1;"));
ASSERT_EQUALS("a = 1.0 ;", tokenizeAndStringify("a = ((float)1);"));
ASSERT_EQUALS("a = 291.0 ;", tokenizeAndStringify("a = ((float)0x123);"));
ASSERT_EQUALS("a = 1.0 ;", tokenizeAndStringify("a = (double)1;"));
ASSERT_EQUALS("a = 1.0 ;", tokenizeAndStringify("a = ((double)1);"));
ASSERT_EQUALS("a = 291.0 ;", tokenizeAndStringify("a = ((double)0x123);"));
ASSERT_EQUALS("a = 1.0 ;", tokenizeAndStringify("a = (long double)1;"));
ASSERT_EQUALS("a = 1.0 ;", tokenizeAndStringify("a = ((long double)1);"));
ASSERT_EQUALS("a = 291.0 ;", tokenizeAndStringify("a = ((long double)0x123);"));
}
void inlineasm() {