diff tests/testappacct.c @ 772:c6969f1af9f3

Fix app_acct and associated test
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 01 Nov 2011 10:12:18 +0100
parents eac79a449c06
children f4f20a182406
line wrap: on
line diff
--- a/tests/testappacct.c	Sun Oct 30 20:57:59 2011 +0100
+++ b/tests/testappacct.c	Tue Nov 01 10:12:18 2011 +0100
@@ -252,15 +252,21 @@
 	/* Now, check the record was actually registered properly */
 	{
 		PGresult * res;
-		char * s;
+		uint8_t * bs;
+		char * es;
+		size_t l;
+		int i;
 		res = PQexec(conn, "SELECT \"Session-Id\" from " TABLE ";");
 		CHECK( PGRES_TUPLES_OK, PQresultStatus(res) );
 		
 		/* We also check that the Session-Id we retrieve is the same as what we generated earlier (not trashed in the process) */
-		s = PQgetvalue(res, 0, 0);
-		CHECK( 0, strcmp(s, (char *)sess_bkp) );
+		es = PQgetvalue(res, 0, 0);
+		bs = PQunescapeBytea((uint8_t *)es, &l);
+		
+		CHECK( 0, fd_os_cmp(bs, l, sess_bkp, sess_bkp_len) );
 		
 		PQclear(res);
+		PQfreemem(bs);
 	}  
 
 	/* That's all for the tests yet */
"Welcome to our mercurial repository"