Browse Source

Fix memory leaks in the bcl test

Signed-off-by: Gavin Howard <gavin@yzena.com>
line_libs
Gavin Howard 11 months ago
parent
commit
343a484995
Signed by: gavin
GPG Key ID: C08038BDF280D33E
  1. 24
      tests/bcl.c

24
tests/bcl.c

@ -254,18 +254,26 @@ int main(void) {
if (strcmp(res, ".01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(bcl_dup(n2));
if (strcmp(res, "-.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(bcl_dup(n3));
if (strcmp(res, "1.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(bcl_dup(n4));
if (strcmp(res, "-1.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
bcl_setLeadingZeroes(true);
if (!bcl_leadingZeroes())
@ -275,18 +283,26 @@ int main(void) {
if (strcmp(res, "0.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(bcl_dup(n2));
if (strcmp(res, "-0.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(bcl_dup(n3));
if (strcmp(res, "1.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(bcl_dup(n4));
if (strcmp(res, "-1.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
bcl_setLeadingZeroes(false);
if (bcl_leadingZeroes())
@ -296,18 +312,26 @@ int main(void) {
if (strcmp(res, ".01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(n2);
if (strcmp(res, "-.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(n3);
if (strcmp(res, "1.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
res = bcl_string(n4);
if (strcmp(res, "-1.01"))
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
free(res);
bcl_ctxt_freeNums(ctxt);
bcl_gc();

Loading…
Cancel
Save