Self-test implementations.
95{
96 char* ret = NULL;
97 char* reference = NULL;
98
99
100 reference = "0";
102 for (int i = 0; i < strlen(reference) && i < strlen(ret); i++) {
103 assert(ret[i] == reference[i]);
104 }
105 if (ret != NULL) {
107 }
108
109
110 reference = "18446744073709551615";
112 for (int i = 0; i < strlen(reference) && i < strlen(ret); i++) {
113 assert(ret[i] == reference[i]);
114 }
115 if (ret != NULL) {
117 }
118
119
120 reference = "18446744073709551615";
122 for (int i = 0; i < strlen(reference) && i < strlen(ret); i++) {
123 assert(ret[i] == reference[i]);
124 }
125 if (ret != NULL) {
127 }
128
129
130 reference = "101010";
132 for (int i = 0; i < strlen(reference) && i < strlen(ret); i++) {
133 assert(ret[i] == reference[i]);
134 }
135 if (ret != NULL) {
137 }
138
139
140 reference = "52";
142 for (int i = 0; i < strlen(reference) && i < strlen(ret); i++) {
143 assert(ret[i] == reference[i]);
144 }
145 if (ret != NULL) {
147 }
148
149
150 reference = "2A";
152 for (int i = 0; i < strlen(reference) && i < strlen(ret); i++) {
153 assert(ret[i] == reference[i]);
154 }
155 if (ret != NULL) {
157 }
158 printf("[+] All tests have successfully passed!\n");
159}
char * decimal_to_anybase(uint64_t nb, const char *alphabet)
decimal_to_anybase ensure the validity of the parameters and convert any unsigned integers into any a...
Definition: decimal_to_any_base.c:73
#define free(ptr)
This macro replace the standard free function with free_dbg.
Definition: malloc_dbg.h:26