Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: MODIFIED: c-unit ...

autounit
Discussion topic

Back to topic list

CVS update: MODIFIED: c-unit ...

Reply

Author sjanes71
Full name Simon Janes
Date 2002-04-29 08:18:36 PDT
Message User: sjanes71
  Date: 02/04/29 08:18:36

  Modified: autounit/c-unit Makefile.am Makefile.in autounit.h test.c
  Added: autounit/c-unit au-reports.h reports.c
  Log:
  In process of separating reporting away from testing. --sjanes71
  
  Revision Changes Path
  1.2 +1 -1 autounit/autounit/c-​unit/Makefile.am
  
  http://autounit.tigr​is.org/source/browse​/autounit/autounit/c​-unit/Makefile.am.di​ff?r1=1.1&r2=1.2​
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Makefile.am
  ====================​====================​====================​=======
  RCS file: /usr/local/tigris/da​ta/helm/cvs/reposito​ry/autounit/autounit​/c-unit/Makefile.am,​v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- Makefile.am 2002/04/25 13:48:05 1.1
  +++ Makefile.am 2002/04/29 15:18:35 1.2
  @@ -11,6 +11,6 @@
       -I../intl \
       -I$(top_srcdir)/intl
   
  -libau_c_unit_la_SOURCES = test.c au-netstring.c suite.c assert.c
  +libau_c_unit_la_SOURCES = test.c au-netstring.c suite.c assert.c reports.c
   libau_c_unit_la_LIBADD = $(GLIB_LIBS)
   libau_c_unit_la_LDFLAGS = -version-info 4:0:2
  
  
  
  1.2 +3 -3 autounit/autounit/c-​unit/Makefile.in
  
  http://autounit.tigr​is.org/source/browse​/autounit/autounit/c​-unit/Makefile.in.di​ff?r1=1.1&r2=1.2​
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Makefile.in
  ====================​====================​====================​=======
  RCS file: /usr/local/tigris/da​ta/helm/cvs/reposito​ry/autounit/autounit​/c-unit/Makefile.in,​v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- Makefile.in 2002/04/25 13:48:05 1.1
  +++ Makefile.in 2002/04/29 15:18:35 1.2
  @@ -109,7 +109,7 @@
   AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)/c-unit -I.. -I../intl -I$(top_srcdir)/intl
   
   
  -libau_c_unit_la_SOURCES = test.c au-netstring.c suite.c assert.c
  +libau_c_unit_la_SOURCES = test.c au-netstring.c suite.c assert.c reports.c
   libau_c_unit_la_LIBADD = $(GLIB_LIBS)
   libau_c_unit_la_LDFLAGS = -version-info 4:0:2
   mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
  @@ -123,7 +123,8 @@
   LDFLAGS = @LDFLAGS@
   LIBS = @LIBS@
   libau_c_unit_la_DEPENDENCIES =
  -libau_c_unit_la_OBJECTS = test.lo au-netstring.lo suite.lo assert.lo
  +libau_c_unit_la_OBJECTS = test.lo au-netstring.lo suite.lo assert.lo \
  +reports.lo
   CFLAGS = @CFLAGS@
   COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
   LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  @@ -353,7 +354,6 @@
             || exit 1; \
         fi; \
       done
  -
   info-am:
   info: info-recursive
   dvi-am:
  
  
  
  1.4 +3 -4 autounit/autounit/c-​unit/autounit.h
  
  http://autounit.tigr​is.org/source/browse​/autounit/autounit/c​-unit/autounit.h.dif​f?r1=1.3&r2=1.4
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: autounit.h
  ====================​====================​====================​=======
  RCS file: /usr/local/tigris/da​ta/helm/cvs/reposito​ry/autounit/autounit​/c-unit/autounit.h,v​
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- autounit.h 2002/04/26 15:49:52 1.3
  +++ autounit.h 2002/04/29 15:18:35 1.4
  @@ -24,9 +24,9 @@
   #include <glib.h>
   
   /* #define AUTOUNIT_TEST_FAIL_MARKER "!" */
  -#define AUTOUNIT_ANSI_GREEN ("\033[01;32m")
  -#define AUTOUNIT_ANSI_RED ("\033[01;31m")
  -#define AUTOUNIT_ANSI_NORM ("\033[0m")
  +#define AUTOUNIT_ANSI_GREEN "\033[01;32m"
  +#define AUTOUNIT_ANSI_RED "\033[01;31m"
  +#define AUTOUNIT_ANSI_NORM "\033[0m"
   #define AUTOUNIT_TEST_PASS_MARKER "."
   #define AUTOUNIT_TEST_FAIL_MARKER "F"
   
  @@ -63,7 +63,6 @@
     GSList *tests;
   };
   typedef struct autounit_suite_t_struct autounit_suite_t;
  -typedef void (*autounit_suite_rep​ort_fp_t)(autounit_s​uite_t *s);
   
   struct autounit_test_t_struct {
     autounit_suite_t *suite;
  
  
  
  1.4 +1 -55 autounit/autounit/c-unit/test.c
  
  http://autounit.tigr​is.org/source/browse​/autounit/autounit/c​-unit/test.c.diff?r1​=1.3&r2=1.4
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: test.c
  ====================​====================​====================​=======
  RCS file: /usr/local/tigris/da​ta/helm/cvs/reposito​ry/autounit/autounit​/c-unit/test.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- test.c 2002/04/26 15:49:52 1.3
  +++ test.c 2002/04/29 15:18:35 1.4
  @@ -27,6 +27,7 @@
   #include <glib.h>
   
   #include <au-netstring.h>
  +#include <au-reports.h>
   #include <autounit.h>
   #include <autounit-private.h>
   
  @@ -282,62 +283,8 @@
     g_timer_destroy(elapsed_timer);
   }
   
  -static void
  -terse_passfail_repo​rt(autounit_test_t *t,autounit_stress_report_t *status) {
  - gboolean ansi_color;
  - ansi_color = TRUE;
  - if (t->failed_assertions > 0) {
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_ANSI_RED));
  - }
  - g_print(_(AUTOUNIT_T​EST_FAIL_MARKER));
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_ANSI_NORM));
  - }
  - } else {
  - if ((*(status->round) % status->modulo) == 0) {
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_A​NSI_GREEN));
  - }
  - g_print(_(AUTOUNIT_T​EST_PASS_MARKER));
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_ANSI_NORM));
  - }
  - }
  - }
  -}
   
  -static void
  -verbose_passfail_re​port(autounit_test_t​ *t,autounit_stress_report_t *status) {
  - gboolean ansi_color;
  - ansi_color = TRUE;
  - if (t->failed_assertions > 0) {
  - g_print(" [ ");
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_ANSI_RED));
  - }
  - g_print(_("FAILED"));
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_ANSI_NORM));
  - }
  - g_print(" %s\n%s ]\n",t->test_nam​e->str,t->test​_status->str);
   
  - } else {
  - if ((*(status->round) % status->modulo) == 0) {
  - g_print(" [ ");
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_A​NSI_GREEN));
  - }
  - g_print(_("PASSED"));
  - if (ansi_color) {
  - g_print(_(AUTOUNIT_ANSI_NORM));
  - }
  - g_print(" %s %s ]\n",t->test_nam​e->str,t->test​_status->str);
  - }
  - }
  -}
  -
  -
   void
   au_run_test_fork(aut​ounit_test_t *t,
            autounit_stress_report_t *status)
  @@ -422,7 +369,6 @@
       verbose_passfail_rep​ort(t,status);
     else
       terse_passfail_repor​t(t,status);
  -
   }
   
   
  
  
  
  1.1 autounit/autounit/c-​unit/au-reports.h
  
  http://autounit.tigr​is.org/source/browse​/autounit/autounit/c​-unit/au-reports.h?r​ev=1.1&content-t​ype=text/x-cvsweb-ma​rkup
  
  Index: au-reports.h
  ====================​====================​====================​=======
  /* Autounit reports
   * Copyright (C) 2001-2002 Simon Janes
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Library General Public
   * License as published by the Free Software Foundation; either
   * version 2 of the License, or (at your option) any later version.
   *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Library General Public License for more details.
   *
   * You should have received a copy of the GNU Library General Public
   * License along with this library; if not, write to the
   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   * Boston, MA 02111-1307, USA.
   */
  
  #ifndef AU_REPORTS_H
  #define AU_REPORTS_H
  
  #include <autounit.h>
  #include <glib.h>
  
  typedef gint (*autounit_suite_rep​ort_fp_t)(autounit_s​uite_t *s);
  typedef gint (*autounit_test_repo​rt_fp_t)(autounit_te​st_t *s,autounit_stress_report_t *status);
  
  /* Report functions used by Autounit to display test results */
  int terse_passfail_repor​t(autounit_test_t *t,autounit_stress_report_t *status);
  int verbose_passfail_rep​ort(autounit_test_t *t,autounit_stress_report_t *status);
  int csv_passfail_report(​autounit_test_t *t,autounit_stress_report_t *status);
  
  #endif /* AU_REPORTS_H */
  
  
  
  1.1 autounit/autounit/c-​unit/reports.c
  
  http://autounit.tigr​is.org/source/browse​/autounit/autounit/c​-unit/reports.c?rev=​1.1&content-type​=text/x-cvsweb-marku​p
  
  Index: reports.c
  ====================​====================​====================​=======
  /* Autounit report
   * Copyright (C) 2001-2002 Simon Janes
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Library General Public
   * License as published by the Free Software Foundation; either
   * version 2 of the License, or (at your option) any later version.
   *
   * This library is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   * Library General Public License for more details.
   *
   * You should have received a copy of the GNU Library General Public
   * License along with this library; if not, write to the
   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   * Boston, MA 02111-1307, USA.
   */
  
  #include <config.h>
  
  #include <string.h>
  #include <stdio.h>
  #include <unistd.h>
  #include <sys/wait.h>
  
  #include <glib.h>
  
  #include <au-netstring.h>
  #include <au-reports.h>
  #include <autounit.h>
  #include <autounit-private.h>
  
  static int
  terse_passfail_repor​t_fmt(autounit_test_​t *t,autounit_stress_report_t *status,gchar *pass,gchar *fail) {
      if (t->failed_assertions > 0) {
      g_print(fail);
      } else {
        if ((*(status->round) % status->modulo) == 0) {
      g_print(pass);
        }
      }
    return 1;
  }
  
  int
  terse_passfail_repor​t(autounit_test_t *t,autounit_stress_report_t *status) {
      gboolean ansi_color;
      ansi_color = TRUE;
      if (ansi_color) {
        return terse_passfail_repor​t_fmt(t,status,
                         AUTOUNIT_ANSI_GREEN AUTOUNIT_TEST_PASS_MARKER AUTOUNIT_ANSI_NORM,
                         AUTOUNIT_ANSI_RED AUTOUNIT_TEST_FAIL_MARKER AUTOUNIT_ANSI_NORM);
      } else {
        return terse_passfail_repor​t_fmt(t,status,AUTOU​NIT_TEST_PASS_MARKER​,AUTOUNIT_TEST_FAIL_​MARKER);
      }
  }
  
  
  static int
  verbose_passfail_rep​ort_fmt(autounit_tes​t_t *t,autounit_stress_report_t *status,gchar *pass,gchar *fail) {
    if (t->failed_assertions > 0) {
      g_print(" [ ");
      g_print(fail);
      g_print(" %s\n%s ]\n",t->test_nam​e->str,t->test​_status->str);
    } else {
      if ((*(status->round) % status->modulo) == 0) {
        g_print(" [ ");
        g_print(pass);
        g_print(" %s %s ]\n",t->test_nam​e->str,t->test​_status->str);
      }
    }
    return 1;
  }
  
  int
  verbose_passfail_rep​ort(autounit_test_t *t,autounit_stress_report_t *status) {
      gboolean ansi_color;
      ansi_color = FALSE;
      if (ansi_color) {
        gchar *pass_str;
        gchar *fail_str;
        gint ret;
        pass_str = g_strdup_printf("%s%​s%s",AUTOUNIT_ANSI_G​REEN,_("PASSED"),AUT​OUNIT_ANSI_NORM);
        fail_str = g_strdup_printf("%s%​s%s",AUTOUNIT_ANSI_R​ED,_("FAILED"),AUTOU​NIT_ANSI_NORM);
        ret = verbose_passfail_rep​ort_fmt(t,status,pas​s_str,fail_str);
        g_free(pass_str);
        g_free(fail_str);
        return ret;
      } else {
        return verbose_passfail_rep​ort_fmt(t,status,_("​PASSED"),_("FAILED")​);
      }
    return 1;
  }
  
  int
  csv_passfail_report(​autounit_test_t *t,autounit_stress_report_t *status) {
    /* Prints a Comma-Separated-Value version of the test for use in
     * reporting tools and spreadsheets.
     */
    if (t->failed_assertions > 0) {
      g_print(_("\"FAILED\","));
      g_print("\"%s\",\​"%s\"\n",t->tes​t_name->str,t-​>test_status->str​);
    } else {
      g_print(_("\"PASSED\","));
      g_print("\"%s\",\​"%s\"",t->test_n​ame->str,t->te​st_status->str);
      g_print(",\"%fd\""​,t->test_seconds_​elapsed);
      g_print(",\"%ld\""​,t->test_useconds​_elapsed);
      g_print("\n");
    }
    return 1;
  }
  
  
  

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@auto​unit.tigris.org
For additional commands, e-mail: cvs-help at autounit dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: MODIFIED: c-unit ... sjanes71 Simon Janes 2002-04-29 08:18:36 PDT
Messages per page: