| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | |
| 5 | /*============================================================================ |
| 6 | ** |
| 7 | ** Source: test17.c |
| 8 | ** |
| 9 | ** Purpose: Tests swscanf with floats (compact notation, uppercase) |
| 10 | ** |
| 11 | ** |
| 12 | **==========================================================================*/ |
| 13 | |
| 14 | |
| 15 | |
| 16 | #include <palsuite.h> |
| 17 | #include "../swscanf.h" |
| 18 | |
| 19 | int __cdecl main(int argc, char *argv[]) |
| 20 | { |
| 21 | if (PAL_Initialize(argc, argv)) |
| 22 | { |
| 23 | return FAIL; |
| 24 | } |
| 25 | |
| 26 | DoFloatTest(convert("123.0" ), convert("%G" ), 123.0f); |
| 27 | DoFloatTest(convert("123.0" ), convert("%2G" ), 12.0f); |
| 28 | DoFloatTest(convert("10E1" ), convert("%G" ), 100.0f); |
| 29 | DoFloatTest(convert("-12.01e-2" ), convert("%G" ), -0.1201f); |
| 30 | DoFloatTest(convert("+12.01e-2" ), convert("%G" ), 0.1201f); |
| 31 | DoFloatTest(convert("-12.01e+2" ), convert("%G" ), -1201.0f); |
| 32 | DoFloatTest(convert("+12.01e+2" ), convert("%G" ), 1201.0f); |
| 33 | DoFloatTest(convert("1234567890.0123456789f" ), convert("%G" ), 1234567936); |
| 34 | |
| 35 | PAL_Terminate(); |
| 36 | return PASS; |
| 37 | } |
| 38 | |