Removing epanet-output from tools folder

epanet-output has been moved to epanet/src/outfile
This commit is contained in:
Michael Tryby
2019-03-20 18:01:11 -04:00
parent ccbb422259
commit 80ce382a38
12 changed files with 0 additions and 1840 deletions

View File

@@ -1,40 +0,0 @@
#
# CMakeLists.txt - CMake configuration file for epanet-output library
#
# Created: March 9, 2018
# Author: Michael E. Tryby
# US EPA ORD/NRMRL
#
cmake_minimum_required (VERSION 3.0)
# Sets for output directory for executables and libraries.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# configure file groups
set(EPANET_OUT_SOURCES src/epanet_output.c src/errormanager.c)
# the binary output file API
add_library(epanet-output SHARED ${EPANET_OUT_SOURCES})
target_include_directories(epanet-output PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
include(GenerateExportHeader)
generate_export_header(epanet-output
BASE_NAME epanet_output
EXPORT_MACRO_NAME EXPORT_OUT_API
EXPORT_FILE_NAME epanet_output_export.h
STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/epanet_output_export.h DESTINATION
${CMAKE_CURRENT_SOURCE_DIR}/include)

View File

@@ -1,82 +0,0 @@
/*
* epanet_output.h - EPANET Output API
*
* Created on: Jun 4, 2014
*
* Author: Michael E. Tryby
* US EPA - ORD/NRMRL
*/
#ifndef EPANET_OUTPUT_H_
#define EPANET_OUTPUT_H_
/* Epanet Results binary file API */
#define MAXFNAME 259 // Max characters in file name
#define MAXID 31 // Max characters in ID name
// This is an opaque pointer to struct. Do not access variables.
typedef void* ENR_Handle;
#include "epanet_output_enums.h"
#include "epanet_output_export.h"
#ifdef __cplusplus
extern "C" {
#endif
int EXPORT_OUT_API ENR_init(ENR_Handle* p_handle_out);
int EXPORT_OUT_API ENR_open(ENR_Handle p_handle_in, const char* path);
int EXPORT_OUT_API ENR_getVersion(ENR_Handle p_handle_in, int* int_out);
int EXPORT_OUT_API ENR_getNetSize(ENR_Handle p_handle_in, int** int_out, int* int_dim);
int EXPORT_OUT_API ENR_getUnits(ENR_Handle p_handle_in, ENR_Units t_enum, int* int_out);
int EXPORT_OUT_API ENR_getTimes(ENR_Handle p_handle_in, ENR_Time t_enum, int* int_out);
int EXPORT_OUT_API ENR_getElementName(ENR_Handle p_handle_in, ENR_ElementType t_enum,
int elementIndex, char** string_out, int* slen);
int EXPORT_OUT_API ENR_getEnergyUsage(ENR_Handle p_handle_in, int pumpIndex,
int* int_out, float** float_out, int* int_dim);
int EXPORT_OUT_API ENR_getNetReacts(ENR_Handle p_handle_in, float** float_out, int* int_dim);
int EXPORT_OUT_API ENR_getNodeSeries(ENR_Handle p_handle_in, int nodeIndex, ENR_NodeAttribute t_enum,
int startPeriod, int endPeriod, float** outValueSeries, int* dim);
int EXPORT_OUT_API ENR_getLinkSeries(ENR_Handle p_handle_in, int linkIndex, ENR_LinkAttribute t_enum,
int startPeriod, int endPeriod, float** outValueSeries, int* dim);
int EXPORT_OUT_API ENR_getNodeAttribute(ENR_Handle p_handle_in, int periodIndex,
ENR_NodeAttribute t_enum, float** outValueArray, int* dim);
int EXPORT_OUT_API ENR_getLinkAttribute(ENR_Handle p_handle_in, int periodIndex,
ENR_LinkAttribute t_enum, float** outValueArray, int* dim);
int EXPORT_OUT_API ENR_getNodeResult(ENR_Handle p_handle_in, int periodIndex, int nodeIndex,
float** float_out, int* int_dim);
int EXPORT_OUT_API ENR_getLinkResult(ENR_Handle p_handle_in, int periodIndex, int linkIndex,
float** float_out, int* int_dim);
int EXPORT_OUT_API ENR_close(ENR_Handle* p_handle_out);
void EXPORT_OUT_API ENR_free(void** array);
void EXPORT_OUT_API ENR_clearError(ENR_Handle p_handle_in);
int EXPORT_OUT_API ENR_checkError(ENR_Handle p_handle_in, char** msg_buffer);
#ifdef __cplusplus
}
#endif
#endif /* EPANET_OUTPUT_H_ */

View File

@@ -1,79 +0,0 @@
/*
* epanet_output_enums.h - EPANET Output API enums
*
* Created on: March 11, 2019
*
* Author: Michael E. Tryby
* US EPA - ORD/NRMRL
*/
#ifndef EPANET_OUTPUT_ENUMS_H_
#define EPANET_OUTPUT_ENUMS_H_
typedef enum {
ENR_node = 1,
ENR_link = 2
} ENR_ElementType;
typedef enum {
ENR_flowUnits = 1,
ENR_pressUnits = 2,
ENR_qualUnits = 3
} ENR_Units;
typedef enum {
ENR_CFS = 0,
ENR_GPM = 1,
ENR_MGD = 2,
ENR_IMGD = 3,
ENR_AFD = 4,
ENR_LPS = 5,
ENR_LPM = 6,
ENR_MLD = 7,
ENR_CMH = 8,
ENR_CMD = 9
} ENR_FlowUnits;
typedef enum {
ENR_PSI = 0,
ENR_MTR = 1,
ENR_KPA = 2
} ENR_PressUnits;
typedef enum {
ENR_NONE = 0,
ENR_MGL = 1,
ENR_UGL = 2,
ENR_HOURS = 3,
ENR_PRCNT = 4
} ENR_QualUnits;
typedef enum {
ENR_reportStart = 1,
ENR_reportStep = 2,
ENR_simDuration = 3,
ENR_numPeriods = 4
}ENR_Time;
typedef enum {
ENR_demand = 1,
ENR_head = 2,
ENR_pressure = 3,
ENR_quality = 4
} ENR_NodeAttribute;
typedef enum {
ENR_flow = 1,
ENR_velocity = 2,
ENR_headloss = 3,
ENR_avgQuality = 4,
ENR_status = 5,
ENR_setting = 6,
ENR_rxRate = 7,
ENR_frctnFctr = 8
} ENR_LinkAttribute;
#endif /* EPANET_OUTPUT_ENUMS_H_ */

View File

@@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
#
# setup.py
#
# Created: 9/20/2017
# Author: Michael E. Tryby
# US EPA - ORD/NRMRL
#
# Setup up script for en_outputapi python extension
#
# Requires:
# Platform C language compiler
# Python packages: numpy
#
try:
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
except ImportError:
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
setup(
name = "epanet-output",
version = "0.1.0-alpha",
ext_modules = [
Extension("_epanet_output",
define_macros = [('epanet_output_EXPORTS', None)],
include_dirs = ['include'],
sources = ['src/epanet_output.i', 'src/epanet_output.c', 'src/errormanager.c'],
swig_opts=['-modern'],
language = 'C'
)
],
package_dir = {'':'src'},
py_modules = ['epanet_output'],
install_requires = [
'enum34'
]
)

File diff suppressed because it is too large Load Diff

View File

@@ -1,203 +0,0 @@
/*
* epanet_output.i - SWIG interface description file for EPANET Output API
*
* Created: 9/20/2017
*
* Author: Michael E. Tryby
* US EPA - ORD/NRMRL
*
*/
%module epanet_output
%{
#include "errormanager.h"
#include "messages.h"
#include "epanet_output.h"
#define SWIG_FILE_WITH_INIT
%}
%include "typemaps.i"
/* DEFINE AND TYPEDEF MUST BE INCLUDED */
#define MAXMSG 53
typedef void* ENR_Handle;
%include "epanet_output_enums.h"
/* TYPEMAPS FOR OPAQUE POINTER */
/* Used for functions that output a new opaque pointer */
%typemap(in, numinputs=0) ENR_Handle* p_handle_out (ENR_Handle retval)
{
/* OUTPUT in */
retval = NULL;
$1 = &retval;
}
/* used for functions that take in an opaque pointer (or NULL)
and return a (possibly) different pointer */
%typemap(argout) ENR_Handle* p_handle_out
{
/* OUTPUT argout */
%append_output(SWIG_NewPointerObj(SWIG_as_voidptr(retval$argnum), $1_descriptor, 0));
}
/* No need for special IN typemap for opaque pointers, it works anyway */
/* TYPEMAP FOR IGNORING INT ERROR CODE RETURN VALUE */
%typemap(out) int {
$result = Py_None;
Py_INCREF($result);
}
/* TYPEMAPS FOR INT ARGUMENT AS RETURN VALUE */
%typemap(in, numinputs=0) int* int_out (int temp) {
$1 = &temp;
}
%typemap(argout) int* int_out {
%append_output(PyInt_FromLong(*$1));
}
/* TYPEMAP FOR MEMORY MANAGEMENT AND ENCODING OF STRINGS */
%typemap(in, numinputs=0)char** string_out (char* temp), int* slen (int temp){
$1 = &temp;
}
%typemap(argout)(char** string_out, int* slen) {
if (*$1) {
PyObject* o;
o = PyUnicode_FromStringAndSize(*$1, *$2);
$result = SWIG_Python_AppendOutput($result, o);
free(*$1);
}
}
/* TYPEMAPS FOR MEMORY MANAGEMNET OF FLOAT ARRAYS */
%typemap(in, numinputs=0)float** float_out (float* temp), int* int_dim (int temp){
$1 = &temp;
}
%typemap(argout) (float** float_out, int* int_dim) {
if (*$1) {
PyObject *o = PyList_New(*$2);
int i;
float* temp = *$1;
for(i=0; i<*$2; i++) {
PyList_SetItem(o, i, PyFloat_FromDouble((double)temp[i]));
}
$result = SWIG_Python_AppendOutput($result, o);
free(*$1);
}
}
/* TYPEMAPS FOR MEMORY MANAGEMENT OF INT ARRAYS */
%typemap(in, numinputs=0)int** int_out (long* temp), int* int_dim (int temp){
$1 = &temp;
}
%typemap(argout) (int** int_out, int* int_dim) {
if (*$1) {
PyObject *o = PyList_New(*$2);
int i;
long* temp = *$1;
for(i=0; i<*$2; i++) {
PyList_SetItem(o, i, PyInt_FromLong(temp[i]));
}
$result = SWIG_Python_AppendOutput($result, o);
free(*$1);
}
}
/* TYPEMAP FOR ENUMERATED TYPES */
%typemap(in) EnumeratedType (int val, int ecode = 0) {
if (PyObject_HasAttrString($input,"value")) {
PyObject* o;
o = PyObject_GetAttrString($input, "value");
ecode = SWIG_AsVal_int(o, &val);
}
else {
SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "$symname" "', argument " "$argnum"" of type '" "$ltype""'");
}
$1 = ($1_type)(val);
}
%apply EnumeratedType {ENR_ElementType, ENR_Units, ENR_Time, ENR_NodeAttribute, ENR_LinkAttribute}
/* RENAME FUNCTIONS PYTHON STYLE */
%rename("%(undercase)s") "";
/* INSERTS CUSTOM EXCEPTION HANDLING IN WRAPPER */
%exception
{
char* err_msg;
ENR_clearError(arg1);
$function
if (ENR_checkError(arg1, &err_msg))
{
PyErr_SetString(PyExc_Exception, err_msg);
SWIG_fail;
}
}
/* INSERT EXCEPTION HANDLING FOR THESE FUNCTIONS */
int ENR_open(ENR_Handle p_handle, const char* path);
int ENR_getVersion(ENR_Handle p_handle, int* int_out);
int ENR_getNetSize(ENR_Handle p_handle, int** int_out, int* int_dim);
int ENR_getUnits(ENR_Handle p_handle, ENR_Units t_enum, int* int_out);
int ENR_getTimes(ENR_Handle p_handle, ENR_Time t_enum, int* int_out);
int ENR_getElementName(ENR_Handle p_handle, ENR_ElementType t_enum,
int elementIndex, char** string_out, int* slen);
int ENR_getEnergyUsage(ENR_Handle p_handle, int pumpIndex,
int* int_out, float** float_out, int* int_dim);
int ENR_getNetReacts(ENR_Handle p_handle, float** float_out, int* int_dim);
int ENR_getNodeAttribute(ENR_Handle p_handle, int periodIndex,
ENR_NodeAttribute t_enum, float** float_out, int* int_dim);
int ENR_getLinkAttribute(ENR_Handle p_handle, int periodIndex,
ENR_LinkAttribute t_enum, float** float_out, int* int_dim);
%exception;
/* NO EXCEPTION HANDLING FOR THESE FUNCTIONS */
int ENR_init(ENR_Handle* p_handle_out);
int ENR_close(ENR_Handle* p_handle_out);
void ENR_free(void** array);
void ENR_clearError(ENR_Handle p_handle);
int ENR_checkError(ENR_Handle p_handle, char** msg_buffer);
/* CODE ADDED DIRECTLY TO SWIGGED INTERFACE MODULE */
%pythoncode%{
import enum
class ElementType(enum.Enum):
NODE = ENR_node
LINK = ENR_link
class Units(enum.Enum):
FLOW_UNIT = ENR_flowUnits
PRESS_UNIT = ENR_pressUnits
class Time(enum.Enum):
REPORT_START = ENR_reportStart
REPORT_STEP = ENR_reportStep
SIM_DURATION = ENR_simDuration
NUM_PERIODS = ENR_numPeriods
class NodeAttribute(enum.Enum):
DEMAND = ENR_demand
HEAD = ENR_head
PRESSURE = ENR_pressure
QUALITY = ENR_quality
class LinkAttribute(enum.Enum):
FLOW = ENR_flow
VELOCITY = ENR_velocity
HEADLOSS = ENR_headloss
AVG_QUALITY = ENR_avgQuality
STATUS = ENR_status
SETTING = ENR_setting
RX_RATE = ENR_rxRate
FRCTN_FCTR = ENR_frctnFctr
%}

View File

@@ -1,74 +0,0 @@
//-----------------------------------------------------------------------------
//
// errormanager.c
//
// Purpose: Provides a simple interface for managing runtime error messages.
//
// Date: 08/25/2017
//
// Author: Michael E. Tryby
// US EPA - ORD/NRMRL
//-----------------------------------------------------------------------------
#include <stdlib.h>
#include <string.h>
#include "errormanager.h"
error_handle_t* new_errormanager(void (*p_error_message)(int, char*, int))
//
// Purpose: Constructs a new error handle.
//
{
error_handle_t* error_handle;
error_handle = (error_handle_t*)calloc(1, sizeof(error_handle_t));
error_handle->p_msg_lookup = p_error_message;
return error_handle;
}
void dst_errormanager(error_handle_t* error_handle)
//
// Purpose: Destroys the error handle.
//
{
free(error_handle);
}
int set_error(error_handle_t* error_handle, int errorcode)
//
// Purpose: Sets an error code in the handle.
//
{
// If the error code is 0 no action is taken and 0 is returned.
// This is a feature not a bug.
if (errorcode)
error_handle->error_status = errorcode;
return errorcode;
}
char* check_error(error_handle_t* error_handle)
//
// Purpose: Returns the error message or NULL.
//
// Note: Caller must free memory allocated by check_error
//
{
char* temp = NULL;
if (error_handle->error_status != 0) {
temp = (char*) calloc(ERR_MAXMSG, sizeof(char));
if (temp)
error_handle->p_msg_lookup(error_handle->error_status, temp, ERR_MAXMSG);
}
return temp;
}
void clear_error(error_handle_t* error_handle)
//
// Purpose: Clears the error from the handle.
//
{
error_handle->error_status = 0;
}

View File

@@ -1,27 +0,0 @@
/*
* errormanager.h
*
* Created on: Aug 25, 2017
*
* Author: Michael E. Tryby
* US EPA - ORD/NRMRL
*/
#ifndef ERRORMANAGER_H_
#define ERRORMANAGER_H_
#define ERR_MAXMSG 256
typedef struct error_s {
int error_status;
void (*p_msg_lookup)(int, char*, int);
} error_handle_t;
error_handle_t* new_errormanager(void (*p_error_message)(int, char*, int));
void dst_errormanager(error_handle_t* error_handle);
int set_error(error_handle_t* error_handle, int errorcode);
char* check_error(error_handle_t* error_handle);
void clear_error(error_handle_t* error_handle);
#endif /* ERRORMANAGER_H_ */

View File

@@ -1,29 +0,0 @@
/*
* messages.h - EPANET
*
* Created on: June 1, 2017
*
* Author: Michael E. Tryby
* US EPA - ORD/NRMRL
*/
#ifndef MESSAGES_H_
#define MESSAGES_H_
/*------------------- Error Messages --------------------*/
#define MSG_MAXLEN 53
#define WARN10 "Warning: model run issued warnings"
#define ERR411 "Input Error 411: no memory allocated for results"
#define ERR412 "Input Error 412: binary file hasn't been opened"
#define ERR421 "Input Error 421: invalid parameter code"
#define ERR422 "Input Error 422: reporting period index out of range"
#define ERR423 "Input Error 423: element index out of range"
#define ERR434 "File Error 434: unable to open binary file"
#define ERR435 "File Error 435: invalid binary file type"
#define ERR436 "File Error 436: no results in binary file"
#define ERRERR "Error: An unknown error has occurred"
#endif /* MESSAGES_H_ */

View File

@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# __init__.py
#
# Created: 11/13/2017
# Author: Michael E. Tryby
# US EPA - ORD/NRMRL
#
import os
DATA_PATH = os.path.abspath(os.path.dirname(__file__))
OUTPUT_FILE_EXAMPLE1 = os.path.join(DATA_PATH, 'net1.out')

View File

@@ -1,251 +0,0 @@
/*
* test_epanet_output.cpp
*
* Created: 8/4/2017
* Author: Michael E. Tryby
* US EPA - ORD/NRMRL
*
* Unit testing for EPANET Output API using google test.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include "gtest/gtest.h"
#include "../src/epanet_output.h"
#define PROJECT_HOME "C:/Users/mtryby/Workspace/GitRepo/michaeltryby/epanet/"
#define DATA_PATH "tools/epanet-output/test/data/net1.out"
namespace {
TEST(ENR_init, InitTest) {
ENR_Handle p_handle;
int error = ENR_init(&p_handle);
ASSERT_EQ(0, error);
ASSERT_TRUE(p_handle != NULL);
}
TEST(ENR_open, OpenTest) {
std::string path = std::string(PROJECT_HOME) + std::string(DATA_PATH);
ENR_Handle p_handle;
ENR_init(&p_handle);
int error = ENR_open(p_handle, path.c_str());
ASSERT_EQ(0, error);
ENR_close(&p_handle);
}
TEST(ENR_close, CloseTest) {
ENR_Handle p_handle;
int error = ENR_init(&p_handle);
error = ENR_close(&p_handle);
ASSERT_EQ(-1, error);
ASSERT_TRUE(p_handle != NULL);
}
class OutputapiTest : public testing::Test {
protected:
// SetUp for OutputapiTest fixture
virtual void SetUp() {
std::string path = std::string(PROJECT_HOME) + std::string(DATA_PATH);
error = ENR_init(&p_handle);
ENR_clearError(p_handle);
error = ENR_open(p_handle, path.c_str());
}
// TearDown for OutputapiTest fixture
virtual void TearDown() {
ENR_free((void**)&array);
error = ENR_close(&p_handle);
}
int error = 0;
ENR_Handle p_handle = NULL;
float* array = NULL;
int array_dim = 0;
};
TEST_F(OutputapiTest, getNetSizeTest) {
int* i_array = NULL;
// nodes, tanks, links, pumps, valves
int ref_array[5] = {11,2,13,1,0};
error = ENR_getNetSize(p_handle, &i_array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_EQ(ref_array[i], i_array[i]);
ENR_free((void**)&i_array);
}
TEST_F(OutputapiTest, getElementName) {
char* name = new char[MAXID];
int length, index = 1;
error = ENR_getElementName(p_handle, ENR_node, index, &name, &length);
ASSERT_EQ(0, error);
EXPECT_STREQ("10", name);
delete(name);
}
TEST_F(OutputapiTest, getNodeAttributeTest) {
float ref_array[11] = { 1.0,
0.44407997,
0.43766347,
0.42827705,
0.41342604,
0.42804748,
0.44152543,
0.40502965,
0.38635802,
1.0,
0.96745253 };
error = ENR_getNodeAttribute(p_handle, 1, ENR_quality, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getLinkAttributeTest) {
float ref_array[13] = { 1848.5812,
1220.4274,
130.11162,
187.6893,
119.8884,
40.464489,
-748.58112,
478.15378,
191.73459,
30.111609,
140.46449,
59.535515,
1848.5812};
error = ENR_getLinkAttribute(p_handle, 1, ENR_flow, &array ,&array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getNodeResultTest) {
float ref_array[4] = {0.041142918,
150.0,
987.98358,
120.45029};
error = ENR_getNodeResult(p_handle, 1, 2, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getLinkResultTest) {
float ref_array[8] = {0.58586824,
1892.2433,
0.0,
-200.71875,
1.0,
3.0,
1.0,
0.0};
error = ENR_getLinkResult(p_handle, 24, 13, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getNodeSeriesTest){
float ref_array[10] = {119.25731,
120.45029,
121.19854,
122.00622,
122.37414,
122.8122,
122.82034,
122.90379,
123.40434,
123.81807};
error = ENR_getNodeSeries(p_handle, 2, ENR_pressure, 0, 10, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getLinkSeriesTest) {
float ref_array[10] = {1234.2072,
1220.4274,
1164.4,
1154.8175,
1100.0635,
1094.759,
1041.7854,
1040.7617,
1087.556,
1082.5011};
error = ENR_getLinkSeries(p_handle, 2, ENR_flow, 0, 10, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getNetReactsTest) {
float ref_array[4] = {18806.59,
85424.438,
115174.05,
238972.66};
error = ENR_getNetReacts(p_handle, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
TEST_F(OutputapiTest, getEnergyUsageTest) {
float ref_array[6] = {57.712959,
75.0,
880.41583,
96.254318,
96.707115,
0.0};
int linkIdx;
error = ENR_getEnergyUsage(p_handle, 1, &linkIdx, &array, &array_dim);
ASSERT_EQ(0, error);
for (int i = 0; i < array_dim; i++)
EXPECT_FLOAT_EQ(ref_array[i], array[i]);
}
}
GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from gtest_main.cc\n");
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}