Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb722020

Browse files
thughescopybara-github
authored andcommitted
Test current behavior of doubles and floats in RecordProperty
PiperOrigin-RevId: 505104193Change-Id: I4c2758f22ee1321ed6b6662ab2668f6c5b6aa661
1 parent403a968 commitb722020

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

‎googletest/test/googletest-json-outfiles-test.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@
9797
'time':'*',
9898
'classname':'PropertyTwo',
9999
'SetUpProp':'2',
100-
'TestSomeProperty':'2',
100+
'TestFloatProperty':'3',
101+
'TestDoubleProperty':'4',
102+
'TestSizetProperty':'5',
101103
'TearDownProp':'2',
102104
}],
103105
}],

‎googletest/test/gtest_xml_outfile2_test_.cc‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,20 @@ class PropertyTwo : public testing::Test {
3939
};
4040

4141
TEST_F(PropertyTwo, TestSomeProperties) {
42+
// 'initializing': conversion from 'int' to 'short', possible loss of data
43+
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4244)
44+
45+
// Floats and doubles are written as int64_t, since RecordProperty takes an
46+
// int64_t, so we test that the values written are truncated to int64_t.
47+
float float_prop =3.25;
48+
RecordProperty("TestFloatProperty", float_prop);
49+
50+
double double_prop =4.75;
51+
RecordProperty("TestDoubleProperty", double_prop);
52+
53+
GTEST_DISABLE_MSC_WARNINGS_POP_()// 4244
54+
4255
// Validate we can write an unsigned size_t as a property
43-
size_tprop_two =2;
44-
RecordProperty("TestSomeProperty",prop_two);
56+
size_tsize_t_prop =5;
57+
RecordProperty("TestSizetProperty",size_t_prop);
4558
}

‎googletest/test/gtest_xml_outfiles_test.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060
<testcase name="TestSomeProperties" file="gtest_xml_outfile2_test_.cc" line="41" status="run" result="completed" time="*" timestamp="*" classname="PropertyTwo">
6161
<properties>
6262
<property name="SetUpProp" value="2"/>
63-
<property name="TestSomeProperty" value="2"/>
63+
<property name="TestFloatProperty" value="3"/>
64+
<property name="TestDoubleProperty" value="4"/>
65+
<property name="TestSizetProperty" value="5"/>
6466
<property name="TearDownProp" value="2"/>
6567
</properties>
6668
</testcase>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp