Revision: 48508
http://brlcad.svn.sourceforge.net/brlcad/?rev=48508&view=rev
Author: brlcad
Date: 2012-01-12 15:53:38 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
remove test_htond since it has a coverity issue and usage is not obvious given
it requires some specific input fed via stdin.
Modified Paths:
--------------
brlcad/trunk/src/libbu/CMakeLists.txt
brlcad/trunk/src/libbu/Makefile.am
Removed Paths:
-------------
brlcad/trunk/src/libbu/test_htond.c
Modified: brlcad/trunk/src/libbu/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libbu/CMakeLists.txt 2012-01-12 15:50:25 UTC (rev
48507)
+++ brlcad/trunk/src/libbu/CMakeLists.txt 2012-01-12 15:53:38 UTC (rev
48508)
@@ -110,9 +110,6 @@
add_executable(test_escape test_escape.c)
target_link_libraries(test_escape libbu)
-add_executable(test_htond test_htond.c)
-target_link_libraries(test_htond libbu)
-
add_executable(test_progname test_progname.c)
target_link_libraries(test_progname libbu)
Modified: brlcad/trunk/src/libbu/Makefile.am
===================================================================
--- brlcad/trunk/src/libbu/Makefile.am 2012-01-12 15:50:25 UTC (rev 48507)
+++ brlcad/trunk/src/libbu/Makefile.am 2012-01-12 15:53:38 UTC (rev 48508)
@@ -6,7 +6,6 @@
test_basename \
test_dirname \
test_escape \
- test_htond \
test_progname \
test_quote \
test_timer \
@@ -97,11 +96,6 @@
libbu_nil.la \
${BU_LIBS}
-test_htond_SOURCES = test_htond.c
-test_htond_LDADD = \
- libbu.la \
- ${BU_LIBS}
-
test_timer_SOURCES = test_timer.c
test_timer_LDADD = \
libbu.la \
Deleted: brlcad/trunk/src/libbu/test_htond.c
===================================================================
--- brlcad/trunk/src/libbu/test_htond.c 2012-01-12 15:50:25 UTC (rev 48507)
+++ brlcad/trunk/src/libbu/test_htond.c 2012-01-12 15:53:38 UTC (rev 48508)
@@ -1,159 +0,0 @@
-/* T E S T _ H T O N D . C
- * BRL-CAD
- *
- * Copyright (c) 2004-2011 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-
-#include "common.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "bu.h"
-
-
-#define NUM 3000
-double orig[NUM], after[NUM];
-unsigned char buf[NUM*8];
-
-void
-flpr(unsigned char *cp)
-{
- unsigned int i;
- for (i=0; i<sizeof(double); i++) {
- putchar("0123456789ABCDEFx"[*cp>>4]);
- putchar("0123456789ABCDEFx"[*cp&0xF]);
- cp++;
- }
- return;
-}
-
-
-int
-ckbytes(unsigned char *a, unsigned char *b, unsigned int n)
-{
-#ifndef vax
- while (n-- > 0) {
- if (*a++ != *b++)
- return -1; /* BAD */
- }
- return 0; /* OK */
-#else
- /* VAX floating point has bytes swapped, vis-a-vis normal VAX order */
- int i;
- for (i=0; i<n; i++) {
- if (a[i^1] != b[i^1])
- return -1; /* BAD */
- }
- return 0; /* OK */
-#endif
-}
-
-
-int
-main(int argc, char **argv)
-{
- int ret;
- unsigned int i;
- unsigned int nbytes;
- volatile int len = sizeof(double);
-
-#define A argv[1][1]
- if (argc != 2 || argv[1][0] != '-' || (A != 'o' && A != 'i' && A != 'v')) {
- bu_exit(1, "Usage: %s [-i|-o|-v] < input\n", argv[0]);
- }
-
- /* First stage, generate the reference pattern */
- for (i=0; i<1000; i++) {
- orig[i] = ((double)i)/(7*16);
- }
- for (i=1000; i<2000; i++) {
- orig[i] = -1.0/(i-1000+1);
- }
- orig[2000] = -1;
- for (i=2001; i<2035; i++) {
- orig[i] = orig[i-1] * -0.1;
- }
- for (i=2035; i<3000; i++) {
- int hilow = (i&1) ? (-1) : 1;
- orig[i] = orig[i-1000] + hilow;
- }
-
- /* Second stage, write out, or read and compare */
- if (argv[1][1] == 'o') {
- /* Write out */
- htond((unsigned char *)buf, (unsigned char *)orig, NUM);
- ret = fwrite(buf, 8, NUM, stdout);
- if (ret != 8)
- perror("fwrite");
- exit(0);
- }
-
- /* Read and compare */
- switch (len) {
- case 8:
- nbytes = 6;
- break;
- case 4:
- default:
- /* untested */
- bu_log("unknown and untested double size, assuming 32-bit\n");
- nbytes = 4;
- break;
- }
-
- /* get some data from stdin */
- ret = fread(buf, 8, NUM, stdin);
- if (ret != 8)
- perror("fread");
-
- for (i=0; i<NUM; i++) {
- ntohd((unsigned char *)&after[i], (unsigned char *)&buf[i*8], 1);
/* incremental */
- /* Floating point compare */
- if ((orig[i] - after[i]) > -SMALL_FASTF && (orig[i] - after[i]) <
SMALL_FASTF)
- continue;
-
- /* Byte-for-byte compare */
- if (ckbytes((unsigned char *)&orig[i],
- (unsigned char *)&after[i], nbytes) == 0)
- continue;
-
- /* Wrong */
- printf("%4d: calc ", i);
- flpr((unsigned char *)&orig[i]);
- printf(" %g\n", orig[i]);
- printf(" aftr ");
- flpr((unsigned char *)&after[i]);
- printf(" %g\n", after[i]);
- printf(" buf ");
- flpr(&buf[i*8]);
- printf("\n");
- }
-
- return 0;
-}
-
-
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits