summaryrefslogtreecommitdiff
path: root/test/UnitsAPI_test/units_test.cpp
blob: 4cb8ac70c74eb433f5cb0d74dc87596de1011506 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <UnitsAPI.hxx>
#include <OSD_Environment.hxx>
#include <stdlib.h>
#include <gtest/gtest.h>

/*
 * Resource files have not yet been installed, so we have
 * to specify their location in sources.
 */
TEST(UnitsAPITestSuite, testCurrentUnits)
{
	OSD_Environment v1("CASROOT", SRC_CASROOT); v1.Build();
	OSD_Environment v2("CSF_CurrentUnitsUserDefaults", SRC_RESOURCE); v2.Build();

	UnitsAPI::SetLocalSystem(UnitsAPI_SI);
	ASSERT_TRUE(0 == strcmp(UnitsAPI::CurrentUnit("LENGTH"), "m"));
}

TEST(UnitsAPITestSuite, testMDTVCurrentUnits)
{
	OSD_Environment v1("CASROOT", SRC_CASROOT); v1.Build ();
	OSD_Environment v2("CSF_MDTVCurrentUnitsUserDefaults", SRC_RESOURCE); v2.Build();
	
	UnitsAPI::SetLocalSystem(UnitsAPI_MDTV);
	ASSERT_TRUE(0 == strcmp(UnitsAPI::CurrentUnit("LENGTH"), "mm"));
}

int main(int argc, char **argv){
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}