Start using .clang-format
Used the one from docs/style/cpp.
Change-Id: I3bdc2b353bf18a437266b362d8205b8463a9ce2b
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-supply/test/test_records.cpp b/power-supply/test/test_records.cpp
index 20b638b..e500322 100644
--- a/power-supply/test/test_records.cpp
+++ b/power-supply/test/test_records.cpp
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include <gtest/gtest.h>
-#include <iostream>
-#include "names_values.hpp"
#include "../record_manager.hpp"
+#include "names_values.hpp"
+
+#include <iostream>
+
+#include <gtest/gtest.h>
using namespace witherspoon::power::history;
@@ -29,41 +31,41 @@
*/
TEST(LinearFormatTest, TestConversions)
{
- //Mantissa > 0, exponent = 0
+ // Mantissa > 0, exponent = 0
EXPECT_EQ(0, RecordManager::linearToInteger(0));
EXPECT_EQ(1, RecordManager::linearToInteger(1));
EXPECT_EQ(38, RecordManager::linearToInteger(0x26));
EXPECT_EQ(1023, RecordManager::linearToInteger(0x3FF));
- //Mantissa < 0, exponent = 0
+ // Mantissa < 0, exponent = 0
EXPECT_EQ(-1, RecordManager::linearToInteger(0x7FF));
EXPECT_EQ(-20, RecordManager::linearToInteger(0x7EC));
EXPECT_EQ(-769, RecordManager::linearToInteger(0x4FF));
EXPECT_EQ(-989, RecordManager::linearToInteger(0x423));
EXPECT_EQ(-1024, RecordManager::linearToInteger(0x400));
- //Mantissa >= 0, exponent > 0
- //M = 1, E = 2
+ // Mantissa >= 0, exponent > 0
+ // M = 1, E = 2
EXPECT_EQ(4, RecordManager::linearToInteger(0x1001));
- //M = 1000, E = 10
+ // M = 1000, E = 10
EXPECT_EQ(1024000, RecordManager::linearToInteger(0x53E8));
- //M = 10, E = 15
+ // M = 10, E = 15
EXPECT_EQ(327680, RecordManager::linearToInteger(0x780A));
- //Mantissa >= 0, exponent < 0
- //M = 0, E = -1
+ // Mantissa >= 0, exponent < 0
+ // M = 0, E = -1
EXPECT_EQ(0, RecordManager::linearToInteger(0xF800));
- //M = 100, E = -2
+ // M = 100, E = -2
EXPECT_EQ(25, RecordManager::linearToInteger(0xF064));
- //Mantissa < 0, exponent < 0
- //M = -100, E = -1
+ // Mantissa < 0, exponent < 0
+ // M = -100, E = -1
EXPECT_EQ(-50, RecordManager::linearToInteger(0xFF9C));
- //M = -1024, E = -7
+ // M = -1024, E = -7
EXPECT_EQ(-8, RecordManager::linearToInteger(0xCC00));
}
@@ -76,10 +78,8 @@
*
* @return vector<uint8_t> the record buffer
*/
-std::vector<uint8_t> makeRawRecord(
- uint8_t sequenceID,
- uint16_t avgPower,
- uint16_t maxPower)
+std::vector<uint8_t> makeRawRecord(uint8_t sequenceID, uint16_t avgPower,
+ uint16_t maxPower)
{
std::vector<uint8_t> record;
@@ -92,13 +92,12 @@
return record;
}
-
/**
* Test record queue management
*/
TEST(ManagerTest, TestRecordAdds)
{
- //Hold 5 max records. IDs roll over at 8.
+ // Hold 5 max records. IDs roll over at 8.
RecordManager mgr{5, 8};
EXPECT_EQ(0, mgr.getNumRecords());
@@ -118,7 +117,7 @@
mgr.add(makeRawRecord(4, 0, 0));
EXPECT_EQ(5, mgr.getNumRecords());
- //start pruning
+ // start pruning
mgr.add(makeRawRecord(5, 0, 0));
EXPECT_EQ(5, mgr.getNumRecords());
@@ -131,30 +130,30 @@
mgr.add(makeRawRecord(8, 0, 0));
EXPECT_EQ(5, mgr.getNumRecords());
- //rollover
+ // rollover
mgr.add(makeRawRecord(0, 0, 0));
EXPECT_EQ(5, mgr.getNumRecords());
mgr.add(makeRawRecord(1, 0, 0));
EXPECT_EQ(5, mgr.getNumRecords());
- //nonsequential ID, clear previous
+ // nonsequential ID, clear previous
mgr.add(makeRawRecord(4, 0, 10));
EXPECT_EQ(1, mgr.getNumRecords());
- //back to normal
+ // back to normal
mgr.add(makeRawRecord(5, 1, 11));
EXPECT_EQ(2, mgr.getNumRecords());
- //One more good record
+ // One more good record
mgr.add(makeRawRecord(6, 2, 12));
EXPECT_EQ(3, mgr.getNumRecords());
- //Add a garbage length record. No size change
+ // Add a garbage length record. No size change
mgr.add(std::vector<uint8_t>(6, 0));
EXPECT_EQ(3, mgr.getNumRecords());
- //Test the DBus Records
+ // Test the DBus Records
auto avgRecords = mgr.getAverageRecords();
EXPECT_EQ(3, avgRecords.size());
@@ -175,8 +174,7 @@
max--;
}
- //Add a zero length record. Records cleared.
+ // Add a zero length record. Records cleared.
mgr.add(std::vector<uint8_t>{});
EXPECT_EQ(0, mgr.getNumRecords());
}
-