Added is_equal_arr and not functions

This commit is contained in:
Dmitriy Shishkov 2021-02-20 20:24:57 +05:00
parent 7c262a29e4
commit 732624c429
No known key found for this signature in database
GPG Key ID: 7CAE12ED13853CAC
3 changed files with 23 additions and 4 deletions

View File

@ -18,9 +18,11 @@ run_tests();
You can use the following functions or just pass boolean value as first argument of `test()`
* `int is_equal(void *res, void *correct);`
* `int is_true(void *res);`
* `int is_false(void *res);`
- `int is_equal(void *res, void *correct)`
- `int is_true(void *res)`
- `int is_false(void *res)`
- `int is_equal_array(void **res, int size, void **correct)`
- `int not(void *res)`
# Installation:
@ -35,5 +37,5 @@ sudo make install CT_VERSION=1
It is also required for update
```bash
sudo make uninstall CT_VERSION=1
sudo make uninstall CT_VERSION=1
```

View File

@ -4,5 +4,7 @@
int is_equal(void *res, void *correct);
int is_true(void *res);
int is_false(void *res);
int is_equal_array(void **res, int size, void **correct);
int not(void *res);
#endif

View File

@ -11,6 +11,21 @@ int is_true(void *res)
}
int is_false(void *res)
{
return !res;
}
int is_equal_array(void **res, int size, void **correct)
{
for (int i = 0; i < size; i++)
if (res[i])
if (res[i] != correct[i])
return 0;
return 1;
}
int not(void *res)
{
return !res;
}