pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pdf-devel] libgnupdf/torture/unit/base/types pdf-i64-abs.c...


From: Daniel
Subject: [pdf-devel] libgnupdf/torture/unit/base/types pdf-i64-abs.c...
Date: Tue, 24 Jun 2008 12:09:50 +0000

CVSROOT:        /cvsroot/pdf
Module name:    libgnupdf
Changes by:     Daniel <danividal>      08/06/24 12:09:50

Added files:
        torture/unit/base/types: pdf-i64-abs.c pdf-i64-cmp.c 
                                 pdf-i64-neg.c 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libgnupdf/torture/unit/base/types/pdf-i64-abs.c?cvsroot=pdf&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libgnupdf/torture/unit/base/types/pdf-i64-cmp.c?cvsroot=pdf&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/libgnupdf/torture/unit/base/types/pdf-i64-neg.c?cvsroot=pdf&rev=1.1

Patches:
Index: pdf-i64-abs.c
===================================================================
RCS file: pdf-i64-abs.c
diff -N pdf-i64-abs.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pdf-i64-abs.c       24 Jun 2008 12:09:50 -0000      1.1
@@ -0,0 +1,119 @@
+/* -*- mode: C -*- Time-stamp: ""
+ *
+ *       File:         pdf-i64-abs.c
+ *       Date:         Mon May 05 16:30:00 2008
+ *
+ *       GNU PDF Library - Types Module - pdf_i64_abs test case
+ *
+ */
+
+/* Copyright (C) 2008 Free Software Foundation, Inc. */
+
+/* This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <pdf.h>
+#include <check.h>
+
+
+
+#define INTERACTIVE_DEBUG 0
+
+/*
+ * Test: pdf_i64_abs_001
+ * Description:
+ *   Checks if the result is the absolute of the number
+ * Success conditions:
+ * The call should produce a positive number from a negative
+ */
+START_TEST(pdf_i64_abs_001)
+{
+
+  int cmp_res;
+  pdf_i64_t k,j;
+
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT
+  pdf_i64_assign(&k,0xFFFFFFFF,0xFFFFFFFE); /*-2*/
+  fail_if(pdf_i64_abs( &j, k ) != PDF_OK);
+  fail_if(j.high != 0);
+  fail_if(j.low != 2);
+#else
+  k = -2;
+  pdf_i64_abs( &j, k );
+  fail_if(j != 2);
+#endif
+
+  
+  
+  
+  
+
+}
+END_TEST
+
+
+/*
+ * Test: pdf_i64_abs_002
+ * Description:
+ *   Checks if result is absolute of the input variable
+ * Success conditions:
+ * The call should produce a positive number from a positive
+ */
+
+START_TEST(pdf_i64_abs_002)
+{
+  
+  int cmp_res;
+  pdf_i64_t k,j;
+
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT
+  pdf_i64_assign(&k,0,2); /*2*/
+  fail_if(pdf_i64_abs( &j, k ) != PDF_OK);
+  fail_if(j.high != 0);
+  fail_if(j.low != 2);
+#else
+  k = 2;
+  pdf_i64_abs( &j, k );
+  fail_if(j != 2);
+#endif
+
+  
+  
+  
+}
+END_TEST
+
+
+
+
+
+
+
+
+/*
+ * Test case creation function
+ */
+TCase *
+test_pdf_i64_abs (void)
+{
+  TCase *tc = tcase_create("pdf_i64_abs");
+  tcase_add_test(tc, pdf_i64_abs_001);
+  tcase_add_test(tc, pdf_i64_abs_002);
+  return tc;
+}
+
+/* End of pdf-i64-abs.c */

Index: pdf-i64-cmp.c
===================================================================
RCS file: pdf-i64-cmp.c
diff -N pdf-i64-cmp.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pdf-i64-cmp.c       24 Jun 2008 12:09:50 -0000      1.1
@@ -0,0 +1,131 @@
+/* -*- mode: C -*- Time-stamp: ""
+ *
+ *       File:         pdf-i64-cmp.c
+ *       Date:         Mon May 05 16:30:00 2008
+ *
+ *       GNU PDF Library - Types Module - pdf_i64_cmp test case
+ *
+ */
+
+/* Copyright (C) 2008 Free Software Foundation, Inc. */
+
+/* This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <pdf.h>
+#include <check.h>
+
+
+
+#define INTERACTIVE_DEBUG 0
+
+/*
+ * Test: pdf_i64_cmp_001
+ * Description:
+ *   Checks if the comparison between a negative and positive
+ * number is carried out properly
+ * Success conditions:
+ * The call should produce a -1
+ */
+START_TEST(pdf_i64_cmp_001)
+{
+
+  int cmp_res;
+  pdf_i64_t k,j;
+  pdf_i64_assign(&k,0xFFFFFFFF,0xFFFFFFFE); /*-2*/
+  pdf_i64_assign(&j,0,2); /*2*/
+
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT
+  cmp_res = pdf_i64_cmp( k, j );
+  fail_if(cmp_res != -1);
+#endif
+  
+  
+
+}
+END_TEST
+
+
+/*
+ * Test: pdf_i64_cmp_002
+ * Description:
+ * Checks if the comparison between a positive and negative
+ * number is carried out properly
+ * Success conditions:
+ * The call should produce a 1
+ */
+
+START_TEST(pdf_i64_cmp_002)
+{
+  
+  int cmp_res;
+  pdf_i64_t k,j;
+  pdf_i64_assign(&k,0xFFFFFFFF,0xFFFFFFFE); /*-2*/
+  pdf_i64_assign(&j,0,2); /*2*/
+
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT
+  cmp_res = pdf_i64_cmp( j, k );
+  fail_if(cmp_res != 1);
+#endif  
+  
+}
+END_TEST
+
+/*
+ * Test: pdf_i64_add_003
+ * Description:
+ *    Checks if the comparison between two equal numbers
+ *  is carried out properly
+ * Success conditions:
+ * The call should produce a 0
+ */
+START_TEST(pdf_i64_cmp_003)
+{
+  
+  int cmp_res;
+  pdf_i64_t k,j;
+  pdf_i64_assign(&k,0,2); /*2*/
+  pdf_i64_assign(&j,0,2); /*2*/
+
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT
+  cmp_res = pdf_i64_cmp( j, k );
+  fail_if(cmp_res != 0);
+#endif  
+  
+
+}
+END_TEST
+
+
+
+
+
+
+/*
+ * Test case creation function
+ */
+TCase *
+test_pdf_i64_cmp (void)
+{
+  TCase *tc = tcase_create("pdf_i64_cmp");
+  tcase_add_test(tc, pdf_i64_cmp_001);
+  tcase_add_test(tc, pdf_i64_cmp_002);
+  tcase_add_test(tc, pdf_i64_cmp_003);
+  return tc;
+}
+
+/* End of pdf-i64-cmp.c */

Index: pdf-i64-neg.c
===================================================================
RCS file: pdf-i64-neg.c
diff -N pdf-i64-neg.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pdf-i64-neg.c       24 Jun 2008 12:09:50 -0000      1.1
@@ -0,0 +1,116 @@
+/* -*- mode: C -*- Time-stamp: ""
+ *
+ *       File:         pdf-i64-neg.c
+ *       Date:         Mon May 05 16:30:00 2008
+ *
+ *       GNU PDF Library - Types Module - pdf_i64_neg test case
+ *
+ */
+
+/* Copyright (C) 2008 Free Software Foundation, Inc. */
+
+/* This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <string.h>
+#include <pdf.h>
+#include <check.h>
+
+
+
+#define INTERACTIVE_DEBUG 0
+
+/*
+ * Test: pdf_i64_neg_001
+ * Description:
+ *   Checks if the result is the negation of the number
+ * Success conditions:
+ * The call should produce a negative number from a positive
+ */
+START_TEST(pdf_i64_neg_001)
+{
+
+  int cmp_res;
+  pdf_i64_t k,j;
+
+  pdf_i64_assign(&k,0,2); /*2*/
+  
+
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT 
+  fail_if(pdf_i64_neg( &j, k ) != PDF_OK);
+  fail_if(j.high != 0xFFFFFFFF);
+  fail_if(j.low != 0xFFFFFFFE);
+#else
+  pdf_i64_neg( &j, k );
+  fail_if(j != -2);
+#endif
+  
+  
+
+}
+END_TEST
+
+
+/*
+ * Test: pdf_i64_neg_002
+ * Description:
+ *   Checks if the result is the negation of the number
+ * Success conditions:
+ * The call should produce a positive number from a negative
+ */
+
+START_TEST(pdf_i64_neg_002)
+{
+  
+int cmp_res;
+  pdf_i64_t k,j;
+  pdf_i64_assign(&k,0xFFFFFFFF,0xFFFFFFFE); /*-2*/
+
+  
+  
+ 
+#ifndef PDF_USE_BUILTIN_64BIT_SUPPORT 
+  fail_if(pdf_i64_neg( &j, k ) != PDF_OK);  
+  fail_if(j.high != 0);
+  fail_if(j.low != 2);
+#else
+  pdf_i64_neg( &j, k );
+  fail_if(j != 2);
+#endif
+  
+}
+END_TEST
+
+
+
+
+
+
+
+
+/*
+ * Test case creation function
+ */
+TCase *
+test_pdf_i64_neg (void)
+{
+  TCase *tc = tcase_create("pdf_i64_neg");
+  tcase_add_test(tc, pdf_i64_neg_001);
+  tcase_add_test(tc, pdf_i64_neg_002);
+  return tc;
+}
+
+/* End of pdf-i64-neg.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]