[svn] gcry - r1139 - trunk/tests
svn author mo
cvs at cvs.gnupg.org
Sat Nov 26 12:52:57 CET 2005
Author: mo
Date: 2005-11-26 12:52:56 +0100 (Sat, 26 Nov 2005)
New Revision: 1139
Modified:
trunk/tests/ChangeLog
trunk/tests/ac-data.c
Log:
2005-11-12 Moritz Schulte <moritz at g10code.com>
* ac-data.c: Added way more test cases.
Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog 2005-11-26 11:52:14 UTC (rev 1138)
+++ trunk/tests/ChangeLog 2005-11-26 11:52:56 UTC (rev 1139)
@@ -1,3 +1,7 @@
+2005-11-12 Moritz Schulte <moritz at g10code.com>
+
+ * ac-data.c: Added way more test cases.
+
2005-09-15 Moritz Schulte <moritz at g10code.com>
* Makefile.am (TESTS): Added keygrip.
Modified: trunk/tests/ac-data.c
===================================================================
--- trunk/tests/ac-data.c 2005-11-26 11:52:14 UTC (rev 1138)
+++ trunk/tests/ac-data.c 2005-11-26 11:52:56 UTC (rev 1139)
@@ -51,15 +51,8 @@
}
static void
-check_sexp_conversion (gcry_ac_data_t data)
+check_sexp_conversion (gcry_ac_data_t data, const char **identifiers)
{
- const char *identifiers[] = { "foo",
- "bar",
- "baz",
- "hello",
- "somemoretexthere",
- "blahblahblah",
- NULL };
gcry_ac_data_t data2;
gcry_error_t err;
gcry_sexp_t sexp;
@@ -70,7 +63,7 @@
err = gcry_ac_data_to_sexp (data, &sexp, identifiers);
assert_err (err);
-
+ gcry_sexp_dump (sexp);
err = gcry_ac_data_from_sexp (&data2, sexp, identifiers);
assert_err (err);
@@ -95,6 +88,14 @@
void
check_run (void)
{
+ const char *identifiers[] = { "foo",
+ "bar",
+ "baz",
+ "hello",
+ "somemoretexthere",
+ "blahblahblah",
+ NULL };
+ const char *identifiers_null[] = { NULL };
gcry_ac_data_t data;
gcry_error_t err;
const char *label0;
@@ -103,6 +104,8 @@
gcry_mpi_t mpi1;
gcry_mpi_t mpi2;
+ /* Initialize values. */
+
label0 = "thisisreallylonglabelbutsincethereisnolimitationonthelengthoflabelsitshouldworkjustfine";
mpi0 = gcry_mpi_new (0);
assert (mpi0);
@@ -111,13 +114,20 @@
err = gcry_ac_data_new (&data);
assert_err (err);
+ check_sexp_conversion (data, identifiers);
+ check_sexp_conversion (data, identifiers_null);
+ check_sexp_conversion (data, NULL);
+
err = gcry_ac_data_set (data, 0, label0, mpi0);
assert_err (err);
err = gcry_ac_data_get_index (data, 0, 0, &label1, &mpi1);
assert_err (err);
assert (label0 == label1);
assert (mpi0 == mpi1);
- check_sexp_conversion (data);
+ check_sexp_conversion (data, identifiers);
+ check_sexp_conversion (data, identifiers_null);
+ check_sexp_conversion (data, NULL);
+
printf ("data-set-test-0 succeeded\n");
gcry_ac_data_clear (data);
@@ -136,7 +146,10 @@
err = gcry_ac_data_set (data, GCRY_AC_FLAG_COPY | GCRY_AC_FLAG_DEALLOC,
"blah1", mpi0);
assert_err (err);
- check_sexp_conversion (data);
+ check_sexp_conversion (data, identifiers);
+ check_sexp_conversion (data, identifiers_null);
+ check_sexp_conversion (data, NULL);
+
err = gcry_ac_data_get_name (data, 0, label0, &mpi1);
assert_err (err);
assert (mpi0 != mpi1);
@@ -153,7 +166,10 @@
gcry_ac_data_clear (data);
assert (! gcry_ac_data_length (data));
- check_sexp_conversion (data);
+ check_sexp_conversion (data, identifiers);
+ check_sexp_conversion (data, identifiers_null);
+ check_sexp_conversion (data, NULL);
+
printf ("data-set-test-2 succeeded\n");
gcry_ac_data_destroy (data);
More information about the Gnupg-commits
mailing list