File: units_test.cpp

package info (click to toggle)
oce 0.18.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 301,548 kB
  • sloc: cpp: 1,190,609; ansic: 67,225; sh: 11,630; tcl: 7,954; cs: 5,221; python: 2,867; java: 1,522; makefile: 342; xml: 292; perl: 37
file content (31 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (7)
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();
}