Revision aad7e13965046c110440d237cf5fbaaadae27c19 authored by Dmitri Naumov on 28 April 2021, 20:11:52 UTC, committed by Dmitry Yu. Naumov on 02 June 2021, 12:47:02 UTC
Plural is incorrect, just a model.
1 parent 07e920f
Raw File
TestPorousMediumStorage.cpp
/*!
   \file
   \brief Test the classes for storage models.

   \copyright
    Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org)
               Distributed under a Modified BSD License.
               See accompanying file LICENSE.txt or
               http://www.opengeosys.org/project/license
*/

#include <gtest/gtest.h>

#include <memory>

#include "BaseLib/ConfigTree.h"
#include "MaterialLib/PorousMedium/Storage/ConstantStorage.h"
#include "MaterialLib/PorousMedium/Storage/createStorageModel.h"
#include "Tests/TestTools.h"

using namespace MaterialLib;
using namespace MaterialLib::PorousMedium;

std::unique_ptr<Storage> createTestStorageModel(const char xml[])
{
    auto const ptree = Tests::readXml(xml);
    BaseLib::ConfigTree conf(ptree, "", BaseLib::ConfigTree::onerror,
                             BaseLib::ConfigTree::onwarning);
    auto const& sub_config = conf.getConfigSubtree("storage");
    return MaterialLib::PorousMedium::createStorageModel(sub_config);
}

TEST(Material, checkConstantStorage)
{
    const char xml[] =
        "<storage>"
        "   <type>Constant</type>"
        "   <value> 1.e-4 </value> "
        "</storage>";
    auto const eta = createTestStorageModel(xml);

    const double var = 0;
    ASSERT_EQ(1.e-4, eta->getValue(var));
}
back to top