mirror of
https://github.com/google/googletest.git
synced 2025-03-11 18:35:35 +00:00
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': '*',
|
'time': '*',
|
||||||
'classname': 'PropertyTwo',
|
'classname': 'PropertyTwo',
|
||||||
'SetUpProp': '2',
|
'SetUpProp': '2',
|
||||||
'TestSomeProperty': '2',
|
'TestFloatProperty': '3',
|
||||||
|
'TestDoubleProperty': '4',
|
||||||
|
'TestSizetProperty': '5',
|
||||||
'TearDownProp': '2',
|
'TearDownProp': '2',
|
||||||
}],
|
}],
|
||||||
}],
|
}],
|
||||||
|
@ -39,7 +39,20 @@ class PropertyTwo : public testing::Test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(PropertyTwo, TestSomeProperties) {
|
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
|
// Validate we can write an unsigned size_t as a property
|
||||||
size_t prop_two = 2;
|
size_t size_t_prop = 5;
|
||||||
RecordProperty("TestSomeProperty", prop_two);
|
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">
|
<testcase name="TestSomeProperties" file="gtest_xml_outfile2_test_.cc" line="41" status="run" result="completed" time="*" timestamp="*" classname="PropertyTwo">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="SetUpProp" value="2"/>
|
<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"/>
|
<property name="TearDownProp" value="2"/>
|
||||||
</properties>
|
</properties>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user