Test current behavior of doubles and floats in RecordProperty
PiperOrigin-RevId: 505104193 Change-Id: I4c2758f22ee1321ed6b6662ab2668f6c5b6aa661
This commit is contained in:
parent
403a968d3c
commit
b72202078d
@ -97,7 +97,9 @@ EXPECTED_2 = {
|
||||
'time': '*',
|
||||
'classname': 'PropertyTwo',
|
||||
'SetUpProp': '2',
|
||||
'TestSomeProperty': '2',
|
||||
'TestFloatProperty': '3',
|
||||
'TestDoubleProperty': '4',
|
||||
'TestSizetProperty': '5',
|
||||
'TearDownProp': '2',
|
||||
}],
|
||||
}],
|
||||
|
@ -39,7 +39,20 @@ class PropertyTwo : public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(PropertyTwo, TestSomeProperties) {
|
||||
// 'initializing': conversion from 'int' to 'short', possible loss of data
|
||||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
|
||||
|
||||
// Floats and doubles are written as int64_t, since RecordProperty takes an
|
||||
// int64_t, so we test that the values written are truncated to int64_t.
|
||||
float float_prop = 3.25;
|
||||
RecordProperty("TestFloatProperty", float_prop);
|
||||
|
||||
double double_prop = 4.75;
|
||||
RecordProperty("TestDoubleProperty", double_prop);
|
||||
|
||||
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4244
|
||||
|
||||
// Validate we can write an unsigned size_t as a property
|
||||
size_t prop_two = 2;
|
||||
RecordProperty("TestSomeProperty", prop_two);
|
||||
size_t size_t_prop = 5;
|
||||
RecordProperty("TestSizetProperty", size_t_prop);
|
||||
}
|
||||
|
@ -60,7 +60,9 @@ EXPECTED_XML_2 = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testcase name="TestSomeProperties" file="gtest_xml_outfile2_test_.cc" line="41" status="run" result="completed" time="*" timestamp="*" classname="PropertyTwo">
|
||||
<properties>
|
||||
<property name="SetUpProp" value="2"/>
|
||||
<property name="TestSomeProperty" value="2"/>
|
||||
<property name="TestFloatProperty" value="3"/>
|
||||
<property name="TestDoubleProperty" value="4"/>
|
||||
<property name="TestSizetProperty" value="5"/>
|
||||
<property name="TearDownProp" value="2"/>
|
||||
</properties>
|
||||
</testcase>
|
||||
|
Loading…
Reference in New Issue
Block a user