cleanup library and some basic tests. Includes, add guards to includes
diff --git a/tests/scripts/generate_code.pl b/tests/scripts/generate_code.pl
index 4591378..ba74738 100755
--- a/tests/scripts/generate_code.pl
+++ b/tests/scripts/generate_code.pl
@@ -65,12 +65,12 @@
 #include POLARSSL_CONFIG_FILE
 #endif
 
+$test_helpers
+
 $suite_pre_code
 $suite_header
 $suite_post_code
 
-$test_helpers
-
 END
 
 $test_main =~ s/SUITE_PRE_DEP/$suite_pre_code/;
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index 73d6767..4e1bac1 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -1,6 +1,9 @@
 #if defined(POLARSSL_PLATFORM_C)
 #include "polarssl/platform.h"
 #else
+#include <stdio.h>
+#define polarssl_printf     printf
+#define polarssl_fprintf    fprintf
 #define polarssl_malloc     malloc
 #define polarssl_free       free
 #endif
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 4a5e104..9d9ebe5 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -1,15 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-
-#if defined(POLARSSL_PLATFORM_C)
-#include "polarssl/platform.h"
-#else
-#define polarssl_printf     printf
-#define polarssl_fprintf    fprintf
-#define polarssl_malloc     malloc
-#define polarssl_free       free
-#endif
-
 #if defined(POLARSSL_MEMORY_BUFFER_ALLOC_C)
 #include "polarssl/memory_buffer_alloc.h"
 #endif
diff --git a/tests/suites/test_suite_ctr_drbg.function b/tests/suites/test_suite_ctr_drbg.function
index a36bab2..c9cb22e 100644
--- a/tests/suites/test_suite_ctr_drbg.function
+++ b/tests/suites/test_suite_ctr_drbg.function
@@ -1,6 +1,8 @@
 /* BEGIN_HEADER */
 #include <polarssl/ctr_drbg.h>
 
+#include <string.h>
+
 int test_offset_idx;
 int entropy_func( void *data, unsigned char *buf, size_t len )
 {
diff --git a/tests/suites/test_suite_hmac_drbg.function b/tests/suites/test_suite_hmac_drbg.function
index bd45112..d58c426 100644
--- a/tests/suites/test_suite_hmac_drbg.function
+++ b/tests/suites/test_suite_hmac_drbg.function
@@ -1,6 +1,8 @@
 /* BEGIN_HEADER */
 #include <polarssl/hmac_drbg.h>
 
+#include <string.h>
+
 typedef struct
 {
     unsigned char *p;