Adding header info
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
Project: OWA EPANET
|
||||
Version: 2.2
|
||||
Module: util/filemanager.c
|
||||
Description: Provides a simple interface for managing files
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 04/01/2019
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
// MSVC ONLY
|
||||
@@ -18,7 +29,6 @@
|
||||
typedef struct file_s {
|
||||
char filename[FILE_MAXNAME + 1];
|
||||
FILE *file;
|
||||
char mode[FILE_MAXMODE + 1];
|
||||
} file_handle_t;
|
||||
|
||||
|
||||
@@ -51,8 +61,7 @@ int open_file(file_handle_t *file_handle, const char *filename, const char *file
|
||||
if (file_mode == NULL)
|
||||
error = -1;
|
||||
else {
|
||||
strncpy(file_handle->mode, file_mode, FILE_MAXMODE);
|
||||
error = _fopen(&(file_handle->file), file_handle->filename, file_handle->mode);
|
||||
error = _fopen(&(file_handle->file), file_handle->filename, file_mode);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
Project: OWA EPANET
|
||||
Version: 2.2
|
||||
Module: util/filemanager.h
|
||||
Description: Provides a simple interface for managing files
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 04/01/2019
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef FILEMANAGER_H_
|
||||
#define FILEMANAGER_H_
|
||||
@@ -17,14 +26,13 @@
|
||||
#endif
|
||||
|
||||
#define FILE_MAXNAME 259
|
||||
#define FILE_MAXMODE 3
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// Forward declariation of file_handle_t
|
||||
typedef struct file_s file_handle_t;
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
Project: OWA EPANET
|
||||
Version: 2.2
|
||||
Module: util/test_filemanager.cpp
|
||||
Description: Tests filemanager
|
||||
Authors: see AUTHORS
|
||||
Copyright: see AUTHORS
|
||||
License: see LICENSE
|
||||
Last Updated: 04/01/2019
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE filemanager
|
||||
|
||||
@@ -12,6 +23,7 @@
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(test_filemanager)
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE (test_create_destroy)
|
||||
{
|
||||
file_handle_t *file_handle = NULL;
|
||||
@@ -55,12 +67,5 @@ struct Fixture{
|
||||
file_handle_t *file_handle;
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(test_get_file, Fixture)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
//file = get_file(file_handle);
|
||||
//BOOST_CHECK(file != NULL);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user