forked from marbl/canu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a reasonably useless test of file reading and writing.
- Loading branch information
1 parent
a71902b
commit 618f916
Showing
3 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
/****************************************************************************** | ||
* | ||
* This file is part of canu, a software program that assembles whole-genome | ||
* sequencing reads into contigs. | ||
* | ||
* This software is based on: | ||
* 'Celera Assembler' (http://wgs-assembler.sourceforge.net) | ||
* the 'kmer package' (http://kmer.sourceforge.net) | ||
* both originally distributed by Applera Corporation under the GNU General | ||
* Public License, version 2. | ||
* | ||
* Canu branched from Celera Assembler at its revision 4587. | ||
* Canu branched from the kmer project at its revision 1994. | ||
* | ||
* Modifications by: | ||
* | ||
* File 'README.licenses' in the root directory of this distribution contains | ||
* full conditions and disclaimers for each license. | ||
*/ | ||
|
||
// g++6 -o filesTest -I.. -I. filesTest.C files.C | ||
|
||
#include "files.H" | ||
|
||
typedef uint8 TYPE; | ||
|
||
|
||
int32 | ||
main(int32 argc, char **argv) { | ||
uint64 nObj = (uint64)16 * 1024 * 1024; | ||
TYPE *array = new TYPE [nObj]; | ||
TYPE value = 0; | ||
|
||
|
||
if (1) { | ||
fprintf(stderr, "Initializing.\n"); | ||
|
||
for (uint64 ii=0; ii<nObj; ii++) | ||
array[ii] = ii; | ||
|
||
fprintf(stderr, "Writing.\n"); | ||
|
||
FILE *OUT = AS_UTL_openOutputFile("./filesTest.dat"); | ||
|
||
writeToFile(array, "array", nObj, OUT); | ||
|
||
AS_UTL_closeFile(OUT); | ||
} | ||
|
||
|
||
if (1) { | ||
fprintf(stderr, "Reading - as one block.\n"); | ||
|
||
FILE *IN = AS_UTL_openInputFile("./filesTest.dat"); | ||
loadFromFile(array, "array", nObj, IN); | ||
AS_UTL_closeFile(IN); | ||
|
||
for (uint64 ii=0; ii<nObj; ii++) | ||
assert(array[ii] == (TYPE)ii); | ||
} | ||
|
||
|
||
if (1) { | ||
fprintf(stderr, "Reading.\n"); | ||
|
||
FILE *IN = AS_UTL_openInputFile("./filesTest.dat"); | ||
|
||
for (uint64 ii=0; ii<nObj; ii++) { | ||
loadFromFile(value, "value", IN); | ||
|
||
assert(value == (TYPE)ii); | ||
} | ||
|
||
fprintf(stderr, "Reading - one after eof.\n"); | ||
loadFromFile(value, "value", IN, false); | ||
loadFromFile(value, "value", IN, true); | ||
|
||
AS_UTL_closeFile(IN); | ||
} | ||
|
||
|
||
exit(0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
# If 'make' isn't run from the root directory, we need to set these to | ||
# point to the upper level build directory. | ||
ifeq "$(strip ${BUILD_DIR})" "" | ||
BUILD_DIR := ../$(OSTYPE)-$(MACHINETYPE)/obj | ||
endif | ||
ifeq "$(strip ${TARGET_DIR})" "" | ||
TARGET_DIR := ../$(OSTYPE)-$(MACHINETYPE) | ||
endif | ||
|
||
TARGET := filesTest | ||
SOURCES := filesTest.C | ||
|
||
SRC_INCDIRS := .. ../utility | ||
|
||
TGT_LDFLAGS := -L${TARGET_DIR}/lib | ||
TGT_LDLIBS := -lcanu | ||
TGT_PREREQS := libcanu.a | ||
|
||
SUBMAKEFILES := |