28 lines
788 B
C++
28 lines
788 B
C++
#include "fesa/material/LinearElasticMaterial.hpp"
|
|
#include "fesa/material/Material.hpp"
|
|
|
|
#include <memory>
|
|
|
|
namespace {
|
|
|
|
int require(bool condition) {
|
|
return condition ? 0 : 1;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int run_material_base_tests() {
|
|
std::unique_ptr<fesa::material::Material> owned =
|
|
std::make_unique<fesa::material::LinearElasticMaterial>(700, 210.0, 0.3);
|
|
const fesa::material::Material& material = *owned;
|
|
const auto& elastic = static_cast<const fesa::material::LinearElasticMaterial&>(material);
|
|
|
|
if (const int result = require(material.id() == 700); result != 0) {
|
|
return result;
|
|
}
|
|
if (const int result = require(elastic.youngModulus() == 210.0); result != 0) {
|
|
return result;
|
|
}
|
|
return require(elastic.poissonRatio() == 0.3);
|
|
}
|