Skip to content

Commit

Permalink
Test datatype sizes (idaholab#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Jan 16, 2020
1 parent eadb4eb commit bcb58e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions unit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ include $(MOOSE_DIR)/modules/modules.mk
###############################################################################

# Extra stuff for GTEST
ADDITIONAL_INCLUDES := -I$(FRAMEWORK_DIR)/contrib/gtest
ADDITIONAL_LIBS := $(FRAMEWORK_DIR)/contrib/gtest/libgtest.la
ADDITIONAL_INCLUDES += -I$(FRAMEWORK_DIR)/contrib/gtest
ADDITIONAL_LIBS += $(FRAMEWORK_DIR)/contrib/gtest/libgtest.la

# dep apps
APPLICATION_DIR := $(CURRENT_DIR)/..
Expand Down
17 changes: 9 additions & 8 deletions unit/src/GSLTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
/* */
/* See COPYRIGHT for full restrictions */
/****************************************************************/
#ifdef GSL_ENABLED

#include <cmath>
#include <gtest/gtest.h>

//GSL includes
// GSL includes
#include <gsl/gsl_integration.h>

// function to integrate
double
function(double x, void * params)
{
double alpha = *(double *) params;
double f = std::log(alpha*x) / std::sqrt(x);
double alpha = *(double *)params;
double f = std::log(alpha * x) / std::sqrt(x);
return f;
}

TEST(GSLTest, integrationTest)
{
gsl_integration_workspace * w
= gsl_integration_workspace_alloc (1000);
gsl_integration_workspace * w = gsl_integration_workspace_alloc(1000);

double result, error;
double alpha = 1.0;
Expand All @@ -39,12 +39,13 @@ TEST(GSLTest, integrationTest)
F.function = &function;
F.params = &alpha;

gsl_integration_qags (&F, 0, 1, 0, 1e-7, 1000,
w, &result, &error);
gsl_integration_qags(&F, 0, 1, 0, 1e-7, 1000, w, &result, &error);

EXPECT_NEAR(result, -4.000000000000085265, 1e-18) << "Integration result is wrong";
EXPECT_NEAR(error, 0.000000000000135447, 1e-18) << "Integration error is wrong";
EXPECT_EQ(w->size, 8);

gsl_integration_workspace_free (w);
gsl_integration_workspace_free(w);
}

#endif

0 comments on commit bcb58e8

Please sign in to comment.