From 3626fc1aafa08c3f884cacea82b92227b74edbe0 Mon Sep 17 00:00:00 2001
From: Dmitry Yurov <d.yurov@fz-juelich.de>
Date: Fri, 3 Nov 2017 15:12:57 +0100
Subject: [PATCH] Added tests for typization of materials

Redmine: #1858
---
 Tests/UnitTests/Core/Other/MaterialTest.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Tests/UnitTests/Core/Other/MaterialTest.h b/Tests/UnitTests/Core/Other/MaterialTest.h
index f87954a3167..f47605fdc54 100644
--- a/Tests/UnitTests/Core/Other/MaterialTest.h
+++ b/Tests/UnitTests/Core/Other/MaterialTest.h
@@ -1,4 +1,6 @@
 #include "MaterialFactoryFuncs.h"
+#include "WavelengthIndependentMaterial.h"
+#include "RefractiveCoefMaterial.h"
 #include "WavevectorInfo.h"
 #include "Rotations.h"
 #include "Units.h"
@@ -138,6 +140,17 @@ TEST_F(MaterialTest, ComputationTest)
     EXPECT_FLOAT_EQ(subtrSLD.imag(), subtrSLDWlIndep.imag());
 }
 
+TEST_F(MaterialTest, TypeIdsTest)
+{
+    Material material = MaterialBySLD("Material", 1.0, 1.0);
+    Material material2 = HomogeneousMaterial("Material", 1.0, 1.0);
+    EXPECT_TRUE(material.typeID() == Material::g_typeID<WavelengthIndependentMaterial>());
+    EXPECT_TRUE(material2.typeID() == Material::g_typeID<RefractiveCoefMaterial>());
+    EXPECT_TRUE(material.typeID() != material2.typeID());
+    Material material3 = MaterialBySLD("Material", 1.0, 1.0);
+    EXPECT_TRUE(material.typeID() == material3.typeID());
+}
+
 TEST_F(MaterialTest, MaterialComparison)
 {
     Material material = MaterialBySLD("Material", 1.0, 1.0);
-- 
GitLab