summaryrefslogtreecommitdiffstats
path: root/googletest/test/gtest_xml_outfile2_test_.cc
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@google.com>2023-02-02 17:31:10 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-02-02 17:31:44 (GMT)
commitdeaf5615f18dd3b051006ba7326e2a976f5dff46 (patch)
tree5b9e60a5421cfbbce158adc605c44439ecee19e0 /googletest/test/gtest_xml_outfile2_test_.cc
parent4f7c63d991824b8034a81a0dd91f8b90a20d7806 (diff)
downloadgoogletest-deaf5615f18dd3b051006ba7326e2a976f5dff46.zip
googletest-deaf5615f18dd3b051006ba7326e2a976f5dff46.tar.gz
googletest-deaf5615f18dd3b051006ba7326e2a976f5dff46.tar.bz2
Fix -Wsign-conversion warnings
googletest/test/gtest_xml_outfile2_test_.cc:48:39: warning: implicit conversion turns floating-point number into integer: 'float' to 'int64_t' (aka 'long') [-Wfloat-conversion] RecordProperty("TestFloatProperty", float_prop); ~~~~~~~~~~~~~~ ^~~~~~~~~~ googletest/test/gtest_xml_outfile2_test_.cc:51:40: warning: implicit conversion turns floating-point number into integer: 'double' to 'int64_t' (aka 'long') [-Wfloat-conversion] RecordProperty("TestDoubleProperty", double_prop); ~~~~~~~~~~~~~~ ^~~~~~~~~~~ googletest/test/gtest_xml_outfile2_test_.cc:57:39: warning: implicit conversion changes signedness: 'size_t' (aka 'unsigned long') to 'int64_t' (aka 'long') [-Wsign-conversion] RecordProperty("TestSizetProperty", size_t_prop); ~~~~~~~~~~~~~~ ^~~~~~~~~~~ PiperOrigin-RevId: 506644143 Change-Id: I9c2cd5f52daebe25e73bb97f696687797ed2cabf
Diffstat (limited to 'googletest/test/gtest_xml_outfile2_test_.cc')
-rw-r--r--googletest/test/gtest_xml_outfile2_test_.cc35
1 files changed, 27 insertions, 8 deletions
diff --git a/googletest/test/gtest_xml_outfile2_test_.cc b/googletest/test/gtest_xml_outfile2_test_.cc
index 047d3f6..5ee216d 100644
--- a/googletest/test/gtest_xml_outfile2_test_.cc
+++ b/googletest/test/gtest_xml_outfile2_test_.cc
@@ -38,21 +38,40 @@ class PropertyTwo : public testing::Test {
void TearDown() override { RecordProperty("TearDownProp", 2); }
};
-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.
+TEST_F(PropertyTwo, TestInt64Properties) {
+ // Floats and doubles are written as 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 size_t_prop = 5;
RecordProperty("TestSizetProperty", size_t_prop);
+
+ bool bool_prop = true;
+ RecordProperty("TestBoolProperty", bool_prop);
+
+ char char_prop = 'A';
+ RecordProperty("TestCharProperty", char_prop);
+
+ int16_t int16_prop = 6;
+ RecordProperty("TestInt16Property", int16_prop);
+
+ int32_t int32_prop = 7;
+ RecordProperty("TestInt32Property", int32_prop);
+
+ int64_t int64_prop = 8;
+ RecordProperty("TestInt64Property", int64_prop);
+
+ enum Foo {
+ NINE = 9,
+ };
+ Foo enum_prop = NINE;
+ RecordProperty("TestEnumProperty", enum_prop);
+
+ std::atomic<int> atomic_int_prop(10);
+ RecordProperty("TestAtomicIntProperty", atomic_int_prop);
}