Index: approxBasisSollya/test/test-read-lines/test-read-lines-suite-1.c
===================================================================
--- approxBasisSollya/test/test-read-lines/test-read-lines-suite-1.c	(revision 0)
+++ approxBasisSollya/test/test-read-lines/test-read-lines-suite-1.c	(revision 301)
@@ -0,0 +1,147 @@
+/** @file test-read-lines-suite-1.c
+ * Test the basic features of the read-lines library.
+ *
+ * @author ST
+ * @date   2018-03-14
+ *
+ */
+/******************************************************************************/
+
+/* includes of system headers */
+#include <stdlib.h>
+#include <stdio.h>
+
+/* includes of project (CUnit) headers */
+#include <CUnit.h>
+#include <Basic.h>
+
+/* includes of local (functions to test) headers */
+#include<read-lines-from-file.h>
+
+/* Exportable prototypes (cleanup, init, setup, teardown and test functions),*/
+
+/* The suite cleanup, init, setup, teardown functions (name used in 
+   the driver program to build the suite). */
+int
+test_read_lines_suite_1_cleanup(void);
+
+int
+test_read_lines_suite_1_init(void);
+
+void
+test_read_lines_suite_1_setup(void);
+
+void
+test_read_lines_suite_1_teardown(void);
+
+/* Test functions of the suite (one function per test in the suite,
+   names are used in the driver program to build the suite).*/
+void
+test_read_lines_suite_1_test_1();
+
+void
+test_read_lines_suite_1_test_2();
+
+void
+test_read_lines_suite_1_test_3();
+
+void
+test_read_lines_suite_1_test_4();
+
+void
+test_read_lines_suite_1_test_5();
+
+/* The topmost part of the file is included by main program to initialize
+   data structures. The lower part is kept her to avoid double definitions.*/
+#ifndef TEST_DRIVER
+/* Internal prototypes */
+
+/* Types, constants and macros definitions */
+
+/* Global variables */
+
+/* Function definitions */
+
+/** Suite management functions. **/
+int
+test_read_lines_suite_1_cleanup()
+{
+  return(0);
+} /* End test_read_lines_suite_1_cleanp() */
+
+int
+test_read_lines_suite_1_init(void)
+{
+  return(0);
+} /* End test_read_lines_suite_1_init. */
+
+void
+test_read_lines_suite_1_setup(void)
+{
+} /* End test_read_lines_suite_1_setup. */
+
+void
+test_read_lines_suite_1_teardown(void)
+{
+} /* End test_read_lines_suite_1_teardown. */
+
+void
+test_read_lines_suite_1_test_1()
+{
+  rlff_readLines_t* linesRead = NULL;
+
+  linesRead = rlff_read_lines_from_file_name("non-existant-file.txt");
+  CU_ASSERT_PTR_NULL_FATAL(linesRead);
+} /* End test_read_lines_suite_1_test_1. */
+
+void
+test_read_lines_suite_1_test_2()
+{
+  rlff_readLines_t* linesRead = NULL;
+
+  linesRead = rlff_read_lines_from_file_name("basis-01.txt");
+  CU_ASSERT_PTR_NOT_NULL_FATAL(linesRead);
+  CU_ASSERT_EQUAL(linesRead->linesNum, 8);
+  CU_ASSERT_EQUAL(linesRead->linesLength, 9);
+  rlff_free_lines(linesRead);
+} /* End test_read_lines_suite_1_test_2. */
+
+void
+test_read_lines_suite_1_test_3()
+{
+  rlff_readLines_t* linesRead = NULL;
+
+  linesRead = rlff_read_lines_from_file_name("basis-02.txt");
+  CU_ASSERT_PTR_NOT_NULL_FATAL(linesRead);
+  CU_ASSERT_EQUAL(linesRead->linesNum, 8);
+  CU_ASSERT_EQUAL(linesRead->linesLength, 11);
+  rlff_free_lines(linesRead);
+} /* End test_read_lines_suite_1_test_3. */
+
+void
+test_read_lines_suite_1_test_4()
+{
+  rlff_readLines_t* linesRead = NULL;
+
+  /* basis-03.txt is a zero-length file. */
+  linesRead = rlff_read_lines_from_file_name("basis-03.txt");
+  CU_ASSERT_PTR_NOT_NULL_FATAL(linesRead);
+  CU_ASSERT_EQUAL(linesRead->linesNum, 0);
+  CU_ASSERT_EQUAL(linesRead->linesLength, 0);
+  rlff_free_lines(linesRead);
+} /* End test_read_lines_suite_1_test_4. */
+
+void
+test_read_lines_suite_1_test_5()
+{
+  rlff_readLines_t* linesRead = NULL;
+
+  /* basis-04.txt is only made of a comment line starting with spaces. */
+  linesRead = rlff_read_lines_from_file_name("basis-04.txt");
+  CU_ASSERT_PTR_NOT_NULL_FATAL(linesRead);
+  CU_ASSERT_EQUAL(linesRead->linesNum, 0);
+  CU_ASSERT_EQUAL(linesRead->linesLength, 0);
+  rlff_free_lines(linesRead);
+} /* End test_read_lines_suite_1_test_5. */
+
+#endif

Property changes on: approxBasisSollya/test/test-read-lines/test-read-lines-suite-1.c
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: approxBasisSollya/test/test-read-lines/test-read-lines-basic-driver.c
===================================================================
--- approxBasisSollya/test/test-read-lines/test-read-lines-basic-driver.c	(revision 0)
+++ approxBasisSollya/test/test-read-lines/test-read-lines-basic-driver.c	(revision 301)
@@ -0,0 +1,133 @@
+/** @file test-read-lines-basic-driver.c
+ * Name and purpose 
+ * Driver program to run test suites
+ * using the CUnit Basic interface.
+ *                                                  
+ * @author ST
+ * @date   2018-03-14
+ */
+/******************************************************************************/
+
+/* Includes of system headers */
+#include <stdlib.h>
+#include <stdio.h>
+
+/* Includes of project headers */
+#include <Basic.h>
+
+
+/* Includes of local (suite) headers */
+
+/* Includes of test suite prototypes */
+  /* This definition is to limit inclusion to local headers (and
+     not include functions definition). */
+#define TEST_DRIVER 1
+#include "test-read-lines-suite-1.c"
+
+/* Internal prototypes */
+
+
+  /* Register the test suites.*/
+CU_ErrorCode
+register_suites_and_display_error(CU_SuiteInfo* suites);
+
+/* Types, constants and macros definitions */
+
+/* Global variables */
+
+/* Tests. */
+/* Individual suite definitions : each suite is defined by:
+- a CU_TestInfo array (e.g. suite1);
+- a list of individual tests (each element has two fields):
+  - a name string (e.g. "suite1test1"),
+  - a function name (e.g. suite1_test1);
+- the list ends with a CU_TEST_INFO_NULL element. */
+CU_TestInfo test_read_lines_suite_1[] =
+{
+  {"test_read_lines_suite_1_test_1",
+      test_read_lines_suite_1_test_1},
+  {"test_read_lines_suite_1_test_2",
+      test_read_lines_suite_1_test_2},
+  {"test_read_lines_suite_1_test_3",
+      test_read_lines_suite_1_test_3},
+  {"test_read_lines_suite_1_test_4",
+      test_read_lines_suite_1_test_4},
+  {"test_read_lines_suite_1_test_5",
+      test_read_lines_suite_1_test_5},
+  CU_TEST_INFO_NULL,
+}; /* End test_read_lines_suite_1. */
+
+/* Suites definition list defined by:
+- a CU_SuiteInfo array (e.g. suites) ;
+- a list of suites (each individual element has four fields):
+  - a name string (e.g. "suite1"),
+  - a suite initializing function (e.g. suite1_init),
+  - a suite cleanup function (e.g. suite1_cleanup),
+  - a suite setup function (e.g. suite_setup),
+  - a suite teardown function (e.g. suite_teardown),
+  - the name of the suite tests array (see above);
+- the list ends with a CU_SUITE_INFO_NULL element. */
+CU_SuiteInfo test_read_lines_suites[] =
+{
+  {"test_read_lines_suite_1",
+      test_read_lines_suite_1_init,
+      test_read_lines_suite_1_cleanup,
+      test_read_lines_suite_1_setup,
+      test_read_lines_suite_1_teardown,
+        test_read_lines_suite_1},
+  CU_SUITE_INFO_NULL,
+}; /* End test_read_lines_suites. */
+
+/* Functions */
+
+int main(int argc, char** argv)
+{
+  CU_ErrorCode last_error;
+  unsigned int tests_failed_count = 0;
+
+            /**************************************/
+            /* Initialize the CUnit test registry */
+            /**************************************/
+  if (CUE_SUCCESS != CU_initialize_registry())
+    return CU_get_error();
+
+          /*****************************************/
+          /* Add register the suites.              */
+          /*****************************************/
+  /* The argument is the name of the name of the suites definition list
+     (e.g. suites)*/
+  last_error = register_suites_and_display_error(test_read_lines_suites);
+  if (last_error != CUE_SUCCESS)
+  {
+    CU_cleanup_registry();
+    return(last_error);
+  }
+   CU_basic_set_mode(CU_BRM_VERBOSE);
+   last_error = CU_basic_run_tests();
+   if (last_error != CUE_SUCCESS)
+   {
+     fprintf(stderr, "Tests execution failed for some internal reason: %s.\n",
+             CU_get_error_msg());
+     CU_cleanup_registry();
+     return(last_error);
+   }
+   //CU_console_run_tests();
+   tests_failed_count = CU_get_number_of_tests_failed();
+   CU_cleanup_registry();
+   return tests_failed_count;
+} /* End main */
+
+/* Helper functions. */
+
+CU_ErrorCode
+register_suites_and_display_error(CU_SuiteInfo* suites)
+{
+  CU_ErrorCode register_suites_error;
+  register_suites_error = CU_register_suites(suites);
+  if (register_suites_error != CUE_SUCCESS)
+  {
+    fprintf(stderr, "%s\n", CU_get_error_msg());
+    return(register_suites_error);
+  } /* End if pTest == NULL. */
+  return CUE_SUCCESS;
+} /* End register_suites_and_display_error */

Property changes on: approxBasisSollya/test/test-read-lines/test-read-lines-basic-driver.c
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: approxBasisSollya/test/test-read-lines/Makefile
===================================================================
--- approxBasisSollya/test/test-read-lines/Makefile	(revision 0)
+++ approxBasisSollya/test/test-read-lines/Makefile	(revision 301)
@@ -0,0 +1,73 @@
+CC           = gcc
+CFLAGS       = -Wall -g -I CUnit-include -I ../..
+LDLIB        = #-Wl,--verbose
+
+OBJS         = test-read-lines-suite-1.o \
+               ../../read-lines-from-file.o
+INCS         = 
+SOURCES      = $(INCS)
+
+TEST_DRIVER  = test-read-lines-basic-driver
+
+ALL_TARGETS = $(TEST_DRIVER)
+
+SCRATCH_PRG := $(patsubst %.c,%,$(wildcard *.c))
+SCRATCH_ALL := $(SCRATCH_PRG)
+
+LAST_ARCH_FILE = lastArch.txt
+
+ARCH := $(shell uname -m)
+
+DUMMY := $(shell touch $(LAST_ARCH_FILE))
+
+LAST_ARCH := $(shell cat $(LAST_ARCH_FILE))
+
+ifneq ($(LAST_ARCH), $(ARCH))
+  DUMMY := $(shell echo $(ARCH) > $(LAST_ARCH_FILE))
+  DUMMY := $(shell $(MAKE) clean) 
+endif
+
+ifeq (x86_64, $(ARCH))
+  CFLAGS := -m64 $(CFLAGS)
+  LDLIB  := -L CUnit-lib-$(ARCH) -Wl,-Bstatic -lcunit -Wl,-Bdynamic
+endif
+
+ifeq (ppc64, $(ARCH))
+  CFLAGS := -m64 $(CFLAGS)
+  # LDLIB :=
+endif
+
+ifeq (i686, $(ARCH))
+  CFLAGS := $(CFLAGS)
+  LDLIB  := -L CUnit-lib-$(ARCH) -Wl,-Bstatic -lcunit -Wl,-Bdynamic
+endif
+
+# -------------------------------------------------------------------------
+
+default: all
+# Remove all implicit (suffix) rules. No need to remove pattern rules.
+# Just redefine them.
+.SUFFIXES:
+# Keep the OBJS we want to link with user code.
+.PRECIOUS: $(OBJS)
+
+all: $(ALL_TARGETS)
+test: $(TEST_DRIVER)
+	@$(TEST_DRIVER)
+
+% : %.o $(OBJS)
+	$(CC) $(CFLAGS) -o $@ $< $(OBJS) $(LDLIB)
+
+%.o : %.c $(INCS)
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+# -------------------------------------------------------------------------
+
+.PHONY: clean scratch
+
+clean:
+	@rm -f $(ALL_TARGETS) $(TEST_DRIVER)
+	@rm -f *.o a.out $(OBJS)
+	@rm -f *~ *% #*#
+
+
Index: approxBasisSollya/test/test-read-lines/basis-01.txt
===================================================================
--- approxBasisSollya/test/test-read-lines/basis-01.txt	(revision 0)
+++ approxBasisSollya/test/test-read-lines/basis-01.txt	(revision 301)
@@ -0,0 +1,16 @@
+# Regular file for tests (has spaces and tabs at end of lines).
+# Should yield 8 lines with a maximum length of 9 characters.
+# (one extra slot for the '\0' terminal character).
+aaaaaaaa
+#
+	bcdefgh 
+#
+kl # 123
+          # mn
+op
+q  r  
+s	t  
+uv 
+
+w x y.	 
+

Property changes on: approxBasisSollya/test/test-read-lines/basis-01.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: approxBasisSollya/test/test-read-lines/basis-02.txt
===================================================================
--- approxBasisSollya/test/test-read-lines/basis-02.txt	(revision 0)
+++ approxBasisSollya/test/test-read-lines/basis-02.txt	(revision 301)
@@ -0,0 +1,16 @@
+# Regular file for tests (has comments, spaces and tabs at end of lines).
+# Should yield 8 lines with a maximum length of 8 characters
+# (one slot more for the final '\0' terminal character).
+aaaaaaaa
+#
+      bcdefghi
+#
+kl # 123
+          #mn
+op
+qr
+st
+uv
+
+w x y z.. 
+

Property changes on: approxBasisSollya/test/test-read-lines/basis-02.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: approxBasisSollya/test/test-read-lines/basis-03.txt
===================================================================

Property changes on: approxBasisSollya/test/test-read-lines/basis-03.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: approxBasisSollya/test/test-read-lines/basis-04.txt
===================================================================
--- approxBasisSollya/test/test-read-lines/basis-04.txt	(revision 0)
+++ approxBasisSollya/test/test-read-lines/basis-04.txt	(revision 301)
@@ -0,0 +1 @@
+  # This file has only a comment line.

Property changes on: approxBasisSollya/test/test-read-lines/basis-04.txt
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: approxBasisSollya/test/test-read-lines
___________________________________________________________________
Added: svn:ignore
   + CUnit-include

CUnit-lib-i686

CUnit-lib-x86_64

cunit-suite-template.c

lastArch.txt


