[segyio] 60/376: Make test functions static

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit b1b201d2d8cea39ce29d620e8c442bba476c071c
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Wed Oct 19 14:17:41 2016 +0200

    Make test functions static
---
 tests/test_segy.c     | 18 +++++++++---------
 tests/test_segyspec.c |  4 ++--
 tests/test_utils.c    |  8 ++++----
 tests/unittest.h      | 10 +++++-----
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/tests/test_segy.c b/tests/test_segy.c
index f5d7128..8acd0ea 100644
--- a/tests/test_segy.c
+++ b/tests/test_segy.c
@@ -6,7 +6,7 @@
 
 #include "unittest.h"
 
-void test_interpret_file() {
+static void test_interpret_file() {
     /*
      * test all structural properties of a file, i.e. traces, samples, sorting
      * etc, but don't actually read any data
@@ -198,7 +198,7 @@ void test_interpret_file_prestack() {
 
 */
 
-void testReadInLine_4(){
+static void testReadInLine_4(){
     const char *file = "test-data/small.sgy";
 
     int sorting;
@@ -273,7 +273,7 @@ void testReadInLine_4(){
     fclose(fp);
 }
 
-void testReadCrossLine_22(){
+static void testReadCrossLine_22(){
     const char *file = "test-data/small.sgy";
 
     int sorting;
@@ -350,7 +350,7 @@ void testReadCrossLine_22(){
     fclose(fp);
 }
 
-void test_modify_trace_header() {
+static void test_modify_trace_header() {
     const char *file = "test-data/small-traceheader.sgy";
 
     int err;
@@ -438,7 +438,7 @@ static const char* expected_textheader =
     "C39                                                                             "
     "C40                                                                            \x80";
 
-void test_text_header() {
+static void test_text_header() {
     const char *file = "test-data/text.sgy";
     FILE* fp = fopen( file, "rb" );
 
@@ -450,7 +450,7 @@ void test_text_header() {
     fclose( fp );
 }
 
-void test_trace_header_errors() {
+static void test_trace_header_errors() {
     const char *file = "test-data/small.sgy";
     FILE* fp = fopen( file, "rb" );
     int err;
@@ -485,7 +485,7 @@ void test_trace_header_errors() {
     fclose( fp );
 }
 
-void test_file_error_codes() {
+static void test_file_error_codes() {
     const char *file = "test-data/small.sgy";
     FILE* fp = fopen( file, "rb" );
     fclose( fp );
@@ -542,7 +542,7 @@ void test_file_error_codes() {
     assertTrue( err == SEGY_FSEEK_ERROR, "Could seek in invalid file." );
 }
 
-void test_error_codes_sans_file() {
+static void test_error_codes_sans_file() {
     int err;
 
     unsigned int linenos[] = { 0, 1, 2 };
@@ -560,7 +560,7 @@ void test_error_codes_sans_file() {
                 "Expected sorting to be invalid." );
 }
 
-void test_file_size_above_4GB(){
+static void test_file_size_above_4GB(){
     FILE* fp = tmpfile();
 
     unsigned int trace = 5e6;
diff --git a/tests/test_segyspec.c b/tests/test_segyspec.c
index 9ed8477..5c1016b 100644
--- a/tests/test_segyspec.c
+++ b/tests/test_segyspec.c
@@ -7,7 +7,7 @@
 #include <segyio/segy.h>
 
 
-void testSegyInspection() {
+static void testSegyInspection() {
     const char *path = "test-data/small.sgy";
     double t0 = 1111.0;
 
@@ -54,7 +54,7 @@ void testSegyInspection() {
 
 }
 
-void testAlloc(){
+static void testAlloc(){
     const char *path = "test-data/small.sgy";
     double t0 = 1111.0;
     SegySpec spec;
diff --git a/tests/test_utils.c b/tests/test_utils.c
index c82ad48..b6db05e 100644
--- a/tests/test_utils.c
+++ b/tests/test_utils.c
@@ -4,7 +4,7 @@
 #include <segyio/util.h>
 #include "unittest.h"
 
-void testEbcdicConversion() {
+static void testEbcdicConversion() {
     char expected[] = "Hello there!";
     char str[] = "\xc8\x85\x93\x93\x96\x40\xa3\x88\x85\x99\x85\x4f";
 
@@ -17,7 +17,7 @@ void testEbcdicConversion() {
     assertTrue(strcmp(result, str) == 0, "Converted string did not match the expected result!");
 }
 
-void testEbcdicTable() {
+static void testEbcdicTable() {
     char ascii[256];
     for (unsigned char i = 0; i < 255; i++) {
         ascii[i] = (char) (i + 1);
@@ -35,7 +35,7 @@ void testEbcdicTable() {
     }
 }
 
-void testConversionAllocation() {
+static void testConversionAllocation() {
     char* expected = (char*) "Hello there!";
     char str[] = "\xc8\x85\x93\x93\x96\x40\xa3\x88\x85\x99\x85\x4f";
 
@@ -73,7 +73,7 @@ static void check(float f1, double * epsm) {
     //printf("Error: %.8g != %.8g\n", f1, f2);
 }
 
-void testIBMFloat() {
+static void testIBMFloat() {
     int i;
     float f1;
 
diff --git a/tests/unittest.h b/tests/unittest.h
index b4af6ad..1ee1745 100644
--- a/tests/unittest.h
+++ b/tests/unittest.h
@@ -8,7 +8,7 @@
 #include <string.h>
 #include <math.h>
 
-void testAssertionFailed(const char *message, const char *file, int line) {
+static void testAssertionFailed(const char *message, const char *file, int line) {
     fprintf(stderr, "Assertion failed in file: %s on line: %d\n", file, line);
     if (strlen(message) > 0) {
         fprintf(stderr, "%s", message);
@@ -16,9 +16,9 @@ void testAssertionFailed(const char *message, const char *file, int line) {
     exit(1);
 }
 
-#define assertTrue(value, message) _testAssertTrue((value), (message), __FILE__, __LINE__)
+#define assertTrue(value, message) testAssertTrue((value), (message), __FILE__, __LINE__)
 
-void _testAssertTrue(bool value, const char *message, const char *file, int line) {
+static void testAssertTrue(bool value, const char *message, const char *file, int line) {
     if (!value) {
         if (message && strlen(message) == 0) {
             message = "The expression did not evaluate to true!";
@@ -27,9 +27,9 @@ void _testAssertTrue(bool value, const char *message, const char *file, int line
     }
 }
 
-#define assertClose(expected, actual, eps) _testAssertClose((expected), (actual), (eps), __FILE__, __LINE__)
+#define assertClose(expected, actual, eps) testAssertClose((expected), (actual), (eps), __FILE__, __LINE__)
 
-void _testAssertClose(double expected, double actual, double eps, const char *file, int line) {
+static void testAssertClose(double expected, double actual, double eps, const char *file, int line) {
     double diff = fabs(expected-actual);
     if (diff > eps) {
         char message[1000];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list