Skip to content
Snippets Groups Projects
Commit ef08c584 authored by Vesa Oikonen's avatar Vesa Oikonen
Browse files

new app

parent 1711507b
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ Changes in tpcclib ...@@ -4,7 +4,7 @@ Changes in tpcclib
This is a concise list of changes; commit messages can be found in the This is a concise list of changes; commit messages can be found in the
[Git repository](https://gitlab.utu.fi/vesoik/tpcclib.git). [Git repository](https://gitlab.utu.fi/vesoik/tpcclib.git).
## version 0.8.0 (2023-03-25, in development) ## version 0.8.0 (2023-03-29, in development)
- Removed all support for 32-bit platforms and compilers as unnecessary. - Removed all support for 32-bit platforms and compilers as unnecessary.
- Removed all support for macOS due to lack of testing platform. - Removed all support for macOS due to lack of testing platform.
...@@ -15,7 +15,7 @@ This is a concise list of changes; commit messages can be found in the ...@@ -15,7 +15,7 @@ This is a concise list of changes; commit messages can be found in the
- Application fit_ppf has new function GCDF. - Application fit_ppf has new function GCDF.
- Application htmlgall uses whole window width. - Application htmlgall uses whole window width.
- Added applications simelli, fit_suri, fitmtrap, imgmtrap, b2ptrap, taccbvp, imgcbvp, imgdelay, - Added applications simelli, fit_suri, fitmtrap, imgmtrap, b2ptrap, taccbvp, imgcbvp, imgdelay,
imgflowm, and niinan. imgflowm, niinan, and hist2svg.
- Bug fix in applications dcmframe and tac2nii. - Bug fix in applications dcmframe and tac2nii.
## version 0.7.9 (2022-12-22) ## version 0.7.9 (2022-12-22)
......
...@@ -7,6 +7,7 @@ include_directories (${CMAKE_SOURCE_DIR}/v2/libtpcstatist) ...@@ -7,6 +7,7 @@ include_directories (${CMAKE_SOURCE_DIR}/v2/libtpcstatist)
include_directories (${CMAKE_SOURCE_DIR}/v2/libtpccsv) include_directories (${CMAKE_SOURCE_DIR}/v2/libtpccsv)
include_directories (${CMAKE_SOURCE_DIR}/v2/libtpcisotope) include_directories (${CMAKE_SOURCE_DIR}/v2/libtpcisotope)
include_directories (${CMAKE_SOURCE_DIR}/v2/libtpctac) include_directories (${CMAKE_SOURCE_DIR}/v2/libtpctac)
include_directories (${CMAKE_SOURCE_DIR}/v2/libtpctacmod)
# Make sure the linker can find the libraries once they are built. # Make sure the linker can find the libraries once they are built.
link_directories (${CMAKE_BINARY_DIR}/v2/libtpcextensions) link_directories (${CMAKE_BINARY_DIR}/v2/libtpcextensions)
...@@ -17,10 +18,12 @@ link_directories (${CMAKE_BINARY_DIR}/v2/libtpcstatist) ...@@ -17,10 +18,12 @@ link_directories (${CMAKE_BINARY_DIR}/v2/libtpcstatist)
link_directories (${CMAKE_BINARY_DIR}/v2/libtpccsv) link_directories (${CMAKE_BINARY_DIR}/v2/libtpccsv)
link_directories (${CMAKE_BINARY_DIR}/v2/libtpcisotope) link_directories (${CMAKE_BINARY_DIR}/v2/libtpcisotope)
link_directories (${CMAKE_BINARY_DIR}/v2/libtpctac) link_directories (${CMAKE_BINARY_DIR}/v2/libtpctac)
link_directories (${CMAKE_BINARY_DIR}/v2/libtpctacmod)
# Add executable that is built from the source file(s) # Add executable that is built from the source file(s)
# The extensions are automatically found. # The extensions are automatically found.
add_executable (avgttac avgttac.c) add_executable (avgttac avgttac.c)
add_executable (hist2svg hist2svg.c)
add_executable (interpol interpol.c) add_executable (interpol interpol.c)
add_executable (tac2xml tac2xml.c) add_executable (tac2xml tac2xml.c)
add_executable (tac4frpl tac4frpl.c) add_executable (tac4frpl tac4frpl.c)
...@@ -59,6 +62,7 @@ add_executable (tocr tocr.c) ...@@ -59,6 +62,7 @@ add_executable (tocr tocr.c)
# Link the executable to the libraries. # Link the executable to the libraries.
target_link_libraries (avgttac tpcstatist tpcift tpccsv tpctac tpcextensions m) target_link_libraries (avgttac tpcstatist tpcift tpccsv tpctac tpcextensions m)
target_link_libraries (hist2svg tpctacmod tpcift tpctac tpcextensions m)
target_link_libraries (interpol tpcstatist tpcli tpcift tpctac tpcextensions m) target_link_libraries (interpol tpcstatist tpcli tpcift tpctac tpcextensions m)
target_link_libraries (tac2xml tpcift tpctac tpcextensions m) target_link_libraries (tac2xml tpcift tpctac tpcextensions m)
target_link_libraries (tac4frpl tpcift tpctac tpcextensions m) target_link_libraries (tac4frpl tpcift tpctac tpcextensions m)
...@@ -99,6 +103,7 @@ target_link_libraries (tocr tpctac tpcisotope tpcextensions m) ...@@ -99,6 +103,7 @@ target_link_libraries (tocr tpctac tpcisotope tpcextensions m)
install ( install (
PROGRAMS PROGRAMS
${CMAKE_CURRENT_BINARY_DIR}/avgttac${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_CURRENT_BINARY_DIR}/avgttac${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/hist2svg${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/interpol${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_CURRENT_BINARY_DIR}/interpol${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/tac2xml${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_CURRENT_BINARY_DIR}/tac2xml${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/tac4frpl${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_CURRENT_BINARY_DIR}/tac4frpl${CMAKE_EXECUTABLE_SUFFIX}
...@@ -152,6 +157,7 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BIN ...@@ -152,6 +157,7 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BIN
# #
# Does the usage message work # Does the usage message work
add_test(avgttacUsage avgttac "--help") add_test(avgttacUsage avgttac "--help")
add_test(hist2svgUsage hist2svg "--help")
add_test(interpolUsage interpol "--help") add_test(interpolUsage interpol "--help")
add_test(tac2xmlUsage tac2xml "--help") add_test(tac2xmlUsage tac2xml "--help")
add_test(tac4frplUsage tac4frpl "--help") add_test(tac4frplUsage tac4frpl "--help")
...@@ -188,11 +194,12 @@ add_test(tactimeUsage tactime "--help") ...@@ -188,11 +194,12 @@ add_test(tactimeUsage tactime "--help")
add_test(tacunitUsage tacunit "--help") add_test(tacunitUsage tacunit "--help")
add_test(tocrUsage tocr "--help") add_test(tocrUsage tocr "--help")
set_tests_properties( set_tests_properties(
avgttacUsage interpolUsage tac2xmlUsage tac4frplUsage tacaddUsage tacadd0Usage tacblendUsage avgttacUsage hist2svgUsage interpolUsage tac2xmlUsage tac4frplUsage tacaddUsage
taccalcUsage taccatUsage taccrossUsage taccutUsage taccutyUsage tacdelUsage tacdelnaUsage tacadd0Usage tacblendUsage taccalcUsage taccatUsage taccrossUsage taccutUsage
tacformatUsage tacframeUsage tacinvUsage tacjoinUsage taclistUsage taclnUsage taccutyUsage tacdelUsage tacdelnaUsage tacformatUsage tacframeUsage
tacmatchUsage tacmidyUsage tacmsampUsage tacmultxUsage tacnamesUsage tacinvUsage tacjoinUsage taclistUsage taclnUsage tacmatchUsage tacmidyUsage
tacp2fUsage tacrangeUsage tacrenUsage tacsetxUsage tacsetyUsage tacsortUsage tacsplitUsage tacmsampUsage tacmultxUsage tacnamesUsage tacp2fUsage tacrangeUsage
tacrenUsage tacsetxUsage tacsetyUsage tacsortUsage tacsplitUsage
tacstudyUsage tactimeUsage tacunitUsage tocrUsage tacstudyUsage tactimeUsage tacunitUsage tocrUsage
PROPERTIES PASS_REGULAR_EXPRESSION "Usage: *" PROPERTIES PASS_REGULAR_EXPRESSION "Usage: *"
) )
...@@ -205,6 +212,11 @@ add_test ( ...@@ -205,6 +212,11 @@ add_test (
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/avgttac WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/avgttac
COMMAND bash "./test_avgttac.sh" COMMAND bash "./test_avgttac.sh"
) )
add_test (
NAME hist2svgTests
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/hist2svg
COMMAND bash "./test_hist2svg.sh"
)
add_test ( add_test (
NAME interpolTests NAME interpolTests
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/interpol WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test/interpol
......
/** @file hist2svg.c
* @brief Plot histogram from data given in TAC format.
* @copyright (c) Turku PET Centre
* @author Vesa Oikonen
*/
/// @cond
/*****************************************************************************/
#include "tpcclibConfig.h"
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/*****************************************************************************/
#include "tpcextensions.h"
#include "tpcift.h"
#include "tpctac.h"
/*****************************************************************************/
/*****************************************************************************/
static char *info[] = {
"Plot histogram from data given in TAC format.",
" ",
"Usage: @P [options] datafile svgfile",
" ",
"Options:",
" -c=<Number>",
" The dataset in file to use, in case there are several; by default 1.",
" -x1=<start of x axis>",
" -x2=<end of x axis>",
" -y1=<start of y axis>",
" -y2=<end of y axis>",
" -mt=\"<main title>\"",
" User-specified string to set as main title.",
" -stdoptions", // List standard options like --help, -v, etc
" ",
"See also: tac2svg, imghist",
" ",
"Keywords: TAC, tool",
0};
/*****************************************************************************/
/*****************************************************************************/
/* Turn on the globbing of the command line, since it is disabled by default in
mingw-w64 (_dowildcard=0); in MinGW32 define _CRT_glob instead, if necessary;
In Unix&Linux wildcard command line processing is enabled by default. */
/*
#undef _CRT_glob
#define _CRT_glob -1
*/
int _dowildcard = -1;
/*****************************************************************************/
/*****************************************************************************/
/**
* Main
*/
int main(int argc, char **argv)
{
int ai, help=0, version=0, verbose=1;
char tacfile[FILENAME_MAX], svgfile[FILENAME_MAX];
char main_title[64];
double preset_xmin, preset_xmax, preset_ymin, preset_ymax;
int ci=0;
/*
* Get arguments
*/
if(argc==1) {tpcPrintUsage(argv[0], info, stderr); return(1);}
tacfile[0]=svgfile[0]=(char)0;
main_title[0]=(char)0;
preset_xmin=preset_xmax=preset_ymin=preset_ymax=nan("");
/* Options */
for(ai=1; ai<argc; ai++) if(*argv[ai]=='-') {
if(tpcProcessStdOptions(argv[ai], &help, &version, &verbose)==0) continue;
char *cptr=argv[ai]+1; if(*cptr=='-') cptr++; if(!*cptr) continue;
if(strncasecmp(cptr, "MT=", 3)==0) {
if(strncpyClean(main_title, cptr+3, 64)) continue;
} else if(strncasecmp(cptr, "X1=", 3)==0) {
if(atofCheck(cptr+3, &preset_xmin)==0) continue;
} else if(strncasecmp(cptr, "X2=", 3)==0) {
if(atofCheck(cptr+3, &preset_xmax)==0) continue;
} else if(strncasecmp(cptr, "Y1=", 3)==0) {
if(atofCheck(cptr+3, &preset_ymin)==0) continue;
} else if(strncasecmp(cptr, "Y2=", 3)==0) {
if(atofCheck(cptr+3, &preset_ymax)==0) continue;
} else if(strncasecmp(cptr, "C=", 2)==0) {
if(atoiCheck(cptr+2, &ci)==0 && ci>0) {ci--; continue;}
}
fprintf(stderr, "Error: invalid option '%s'\n", argv[ai]);
return(1);
} else break; // tac name argument may start with '-'
TPCSTATUS status; statusInit(&status);
statusSet(&status, __func__, __FILE__, __LINE__, TPCERROR_OK);
status.verbose=verbose-3;
/* Print help or version? */
if(help==2) {tpcHtmlUsage(argv[0], info, ""); return(0);}
if(help) {tpcPrintUsage(argv[0], info, stdout); return(0);}
if(version) {tpcPrintBuild(argv[0], stdout); return(0);}
/* The first argument (non-option) is the filename */
if(ai<argc) {strlcpy(tacfile, argv[ai], FILENAME_MAX); ai++;}
if(ai<argc) {strlcpy(svgfile, argv[ai], FILENAME_MAX); ai++;}
else {fprintf(stderr, "Error: missing filename.\n"); return(1);}
if(ai<argc) {fprintf(stderr, "Error: extra command-line argument.\n"); return(1);}
if(preset_xmin>=preset_xmax || preset_ymin>=preset_ymax) {
fprintf(stderr, "Error: invalid axis range settings.\n"); return(1);}
/* In verbose mode print arguments and options */
if(verbose>1) {
printf("tacfile := %s\n", tacfile);
printf("svgfile := %s\n", svgfile);
if(main_title[0]) printf("main_title := %s\n", main_title);
if(isfinite(preset_xmin)) printf("preset_xmin := %g\n", preset_xmin);
if(isfinite(preset_xmax)) printf("preset_xmax := %g\n", preset_xmax);
if(isfinite(preset_ymin)) printf("preset_ymin := %g\n", preset_ymin);
if(isfinite(preset_ymax)) printf("preset_ymax := %g\n", preset_ymax);
}
/* Read the file */
if(verbose>1) printf("reading %s\n", tacfile);
TAC tac; tacInit(&tac);
tacRead(&tac, tacfile, &status);
if(status.error!=TPCERROR_OK) {
fprintf(stderr, "Error: %s\n", errorMsg(status.error));
tacFree(&tac); return(2);
}
if(verbose>2) {
printf("fileformat := %s\n", tacFormattxt(tac.format));
printf("tacNr := %d\n", tac.tacNr);
printf("sampleNr := %d\n", tac.sampleNr);
printf("frames := %d\n", tac.isframe);
if(tac.tacNr>1) printf("tac := %s\n", tac.c[ci].name);
}
if(tac.isframe) tacSetX(&tac, NULL);
if(ci>=tac.tacNr) {
fprintf(stderr, "Error: data file does not contain data set %d.\n", 1+ci);
tacFree(&tac); return(2);
}
/* Delete other datasets than the selected one */
if(tac.tacNr>1) {
for(int i=0; i<tac.tacNr; i++) if(i==ci) tac.c[i].sw=0; else tac.c[i].sw=1;
int i=tac.tacNr-1;
while(i>=0) {
if(tac.c[i].sw && tacDeleteTACC(&tac, i)!=TPCERROR_OK) {
fprintf(stderr, "Error: invalid data file.\n");
tacFree(&tac); return(2);
}
i--;
}
}
/* Determine the plot min and max values */
double xmin=nan(""), xmax=nan(""), ymin=nan(""), ymax=nan("");
if(tacXRange(&tac, &xmin, &xmax)) {
fprintf(stderr, "Error: invalid data x range.\n");
tacFree(&tac); return(2);
}
if(verbose>3) printf("data_xrange := %g %g\n", xmin, xmax);
if((isfinite(preset_xmin) && preset_xmin>=xmax) || (isfinite(preset_xmax) && preset_xmax<=xmin)) {
fprintf(stderr, "Error: invalid x axis range settings.\n");
tacFree(&tac); return(1);
}
if(isfinite(preset_xmin)) xmin=preset_xmin;
if(isfinite(preset_xmax)) xmax=preset_xmax;
/* Determine the plot min and max y values inside the x range */
if(tacYRangeInXRange(&tac, 0, xmin, xmax, &ymin, &ymax, NULL, NULL, NULL, NULL)) {
fprintf(stderr, "Error: invalid data y range.\n");
tacFree(&tac); return(2);
}
if(verbose>3) printf("data_yrange := %g %g\n", ymin, ymax);
if((isfinite(preset_ymin) && preset_ymin>=ymax) || (isfinite(preset_ymax) && preset_ymax<=ymin)) {
fprintf(stderr, "Error: invalid y axis range settings.\n");
tacFree(&tac); return(1);
}
if(ymin>0.0) ymin=0.0;
else if(ymax<0.0) ymax=0.0;
if(isfinite(preset_ymin)) ymin=preset_ymin;
if(isfinite(preset_ymax)) ymax=preset_ymax;
if(verbose>3) {
printf("plotted_xrange := %g %g\n", xmin, xmax);
printf("plotted_yrange := %g %g\n", ymin, ymax);
}
/* Plot */
tacPlotHistogramSVG(&tac, main_title, xmin, xmax, ymin, ymax, svgfile, &status);
if(status.error!=TPCERROR_OK) {
fprintf(stderr, "Error: %s\n", errorMsg(status.error));
tacFree(&tac); return(10);
}
tacFree(&tac);
return(0);
}
/*****************************************************************************/
/*****************************************************************************/
/// @endcond
#!/bin/bash
#: Title : test_hist2svg
#: Date : 2023-03-29
#: Author : "Vesa Oikonen" <vesa.oikonen@utu.fi>
#: Options : None
# Set the name of executable to test
if [ -n "${OS+1}" ] && [ "$OS" = "Windows_NT" ]; then
EXT=.exe;
else
EXT=;
fi
PROGRAM=../../hist2svg$EXT;
if [ ! -f $PROGRAM ]; then
printf "Failed: executable does not exist.\n"
exit 1
fi
printf "=====================================================================\n"
printf "creating test data for %s\n" $PROGRAM
printf "=====================================================================\n"
printf "\n Making data for testing \n"
if [ ! -f test.tac ] || [ ! -f test2.tac ] || [ ! -f test.dat ]; then
printf "start\tend\tH1\n" > test.tac
printf "0\t10\t20\n" >> test.tac
printf "10\t20\t80\n" >> test.tac
printf "20\t30\t40\n" >> test.tac
printf "start\tend\tH1\tH2\n" > test2.tac
printf "0\t10\t20\t100\n" >> test2.tac
printf "10\t20\t80\t0\n" >> test2.tac
printf "20\t30\t40\t50\n" >> test2.tac
printf "1\t0\n" > test.dat
printf "2\t0\n" >> test.dat
printf "3\t0\n" >> test.dat
printf "4\t0\n" >> test.dat
printf "5\t0\n" >> test.dat
printf "6\t5\n" >> test.dat
printf "7\t8\n" >> test.dat
printf "8\t0\n" >> test.dat
printf "9\t0\n" >> test.dat
printf "10\t0\n" >> test.dat
printf "11\t0\n" >> test.dat
printf "12\t0\n" >> test.dat
printf "13\t0\n" >> test.dat
printf "14\t0\n" >> test.dat
printf "15\t0\n" >> test.dat
printf "16\t0\n" >> test.dat
printf "17\t0\n" >> test.dat
printf "18\t0\n" >> test.dat
printf "19\t0\n" >> test.dat
printf "20\t0\n" >> test.dat
printf "21\t4\n" >> test.dat
printf "22\t10\n" >> test.dat
printf "23\t2\n" >> test.dat
printf "24\t0\n" >> test.dat
printf "25\t5\n" >> test.dat
printf "26\t0\n" >> test.dat
printf "27\t0\n" >> test.dat
printf "28\t0\n" >> test.dat
printf "29\t0\n" >> test.dat
printf "30\t0\n" >> test.dat
printf "31\t0\n" >> test.dat
printf "32\t0\n" >> test.dat
printf "33\t0\n" >> test.dat
printf "34\t0\n" >> test.dat
printf "35\t0\n" >> test.dat
printf "36\t0\n" >> test.dat
printf "37\t0\n" >> test.dat
printf "38\t0\n" >> test.dat
printf "39\t0\n" >> test.dat
printf "40\t0\n" >> test.dat
fi
printf "\n\n"
printf "=====================================================================\n"
printf "testing %s\n" $PROGRAM
printf "=====================================================================\n"
printf "\n 1.0.0 \n"
printf " Test case: Simple data, no options. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h100.svg
$PROGRAM test.dat h100.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h100.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.0.1 \n"
printf " Test case: Optional title, increased ymax, reduced xmax. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h101.svg
$PROGRAM -mt="Test 1.0.1" -y2=12 -x2=30 test.dat h101.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h101.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.0.2 \n"
printf " Test case: Set x and y axis to start from negative. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h102.svg
$PROGRAM -mt="Test 1.0.2" -x1=-5 -y1=-10 test.dat h102.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h102.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.0.3 \n"
printf " Test case: Set x axis to start from positive. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h103.svg
$PROGRAM -mt="Test 1.0.3" -x1=10 test.dat h103.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h103.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.0.4 \n"
printf " Test case: Set y axis to start from positive. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h104.svg
$PROGRAM -mt="Test 1.0.4" -y1=3 test.dat h104.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h104.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.0.5 \n"
printf " Test case: Set y axis max to hide part of data. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h105.svg
$PROGRAM -mt="Test 1.0.5" -y2=6 test.dat h105.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h105.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.1.0 \n"
printf " Test case: Data is negative. \n"
printf " Expected result: Plot file created. \n\n"
taccalc test.dat x -1 temp.dat
printf "\n ok \n"
rm -f h110.svg
$PROGRAM -c=1 temp.dat h110.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h110.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.2.0 \n"
printf " Test case: Every data point is larger than zero. \n"
printf " Expected result: Plot file created. \n\n"
taccalc test.dat + 100 temp.dat
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
rm -f h120.svg
$PROGRAM -mt="Test 1.2.0" temp.dat h120.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h120.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.2.1 \n"
printf " Test case: Same but when data is negative. \n"
printf " Expected result: Plot file created. \n\n"
taccalc temp.dat x -1 temp2.dat
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
rm -f h121.svg
$PROGRAM -mt="Test 1.2.1" temp2.dat h121.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h121.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 1.3.0 \n"
printf " Test case: Data contains negative and positive values. \n"
printf " Expected result: Plot file created. \n\n"
taccalc test.dat - 3 temp.dat
printf "\n ok \n"
rm -f h130.svg
$PROGRAM -c=1 temp.dat h130.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h130.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "=====================================================================\n"
printf "\n 2.0.0 \n"
printf " Test case: PMOD formatted data with x1 and x2, no options. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h200.svg
$PROGRAM test.tac h200.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h200.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 2.0.1 \n"
printf " Test case: Set y axis max to hide part of data. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h201.svg
$PROGRAM -mt="Test 2.0.1" -y2=60 test.tac h201.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h201.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 2.0.2 \n"
printf " Test case: Set x axis to hide part rectagles from both sides. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h202.svg
$PROGRAM -mt="Test 2.0.2" -x1=8 -x2=25 test.tac h202.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h202.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 2.1.0 \n"
printf " Test case: File contains two datasets; the second one is selected. \n"
printf " Expected result: Plot file created. \n\n"
rm -f h210.svg
$PROGRAM -c=2 test2.tac h210.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h210.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 2.2.0 \n"
printf " Test case: Data is negative. \n"
printf " Expected result: Plot file created. \n\n"
taccalc test2.tac x -1 temp.tac
printf "\n ok \n"
rm -f h220.svg
$PROGRAM -c=2 temp.tac h220.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h220.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n 2.2.1 \n"
printf " Test case: Both negative and positive data. \n"
printf " Expected result: Plot file created. \n\n"
taccalc test2.tac - 30 temp.tac
printf "\n ok \n"
rm -f h221.svg
$PROGRAM -c=1 temp.tac h221.svg
if [ $? -ne 0 ] ; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n ok \n"
if [ ! -f h221.svg ]; then printf "\nFailed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "=====================================================================\n"
printf " All passed!\n"
printf "=====================================================================\n"
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment