We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6eb3dcd commit ec66409Copy full SHA for ec66409
1 file changed
tests/strtod_test.c
@@ -0,0 +1,28 @@
1
+#include "fast_float/fast_float_strtod.h"
2
+#include <stdio.h>
3
+#include <stdlib.h>
4
+#include <errno.h>
5
+
6
+int main() {
7
+ // Test successful conversion
8
+ const char *str1 = "3.14159";
9
+ char *end1;
10
+ errno = 0;
11
+ double d1 = fast_float_strtod(str1, &end1);
12
+ printf("Input: %s\n", str1);
13
+ printf("Converted: %f\n", d1);
14
+ printf("End pointer: %s\n", end1);
15
+ printf("errno: %d\n", errno);
16
17
+ // Test invalid input
18
+ const char *str2 = "invalid";
19
+ char *end2;
20
21
+ double d2 = fast_float_strtod(str2, &end2);
22
+ printf("\nInput: %s\n", str2);
23
+ printf("Converted: %f\n", d2);
24
+ printf("End pointer: %s\n", end2);
25
26
27
+ return 0;
28
+}
0 commit comments