Major formatting changes (breaks diffs). No code changes.

The changes made in this commit do not affect any actual code,
    they are purely aesthetic. I ran clang-format with google style
    over all .h/.cpp files in wpilibc that weren't in wpilibC++Sim
    or gtest, and the eclipse formatter over all of the Java files
    using the Google eclipse formatting configuration.

Change-Id: I9627bca0bc103c398ecc1c5ba17467193291ae63
This commit is contained in:
James Kuszmaul
2015-06-25 15:07:55 -04:00
parent bd64d9a7ef
commit 7eb8550bdb
470 changed files with 89798 additions and 77287 deletions

View File

@@ -18,24 +18,26 @@ static const double kSaveTime = 0.2;
* we get those same values back using the Preference class.
*/
TEST(PreferencesTest, ReadPreferencesFromFile) {
std::remove(kFileName);
std::ofstream preferencesFile(kFileName);
preferencesFile << "[Preferences]" << std::endl;
preferencesFile << "testFileGetString=\"Hello, preferences file\"" << std::endl;
preferencesFile << "testFileGetInt=\"1\"" << std::endl;
preferencesFile << "testFileGetDouble=\"0.5\"" << std::endl;
preferencesFile << "testFileGetFloat=\"0.25\"" << std::endl;
preferencesFile << "testFileGetBoolean=\"true\"" << std::endl;
preferencesFile << "testFileGetLong=\"1000000000000000000\"" << std::endl;
preferencesFile.close();
std::remove(kFileName);
std::ofstream preferencesFile(kFileName);
preferencesFile << "[Preferences]" << std::endl;
preferencesFile << "testFileGetString=\"Hello, preferences file\""
<< std::endl;
preferencesFile << "testFileGetInt=\"1\"" << std::endl;
preferencesFile << "testFileGetDouble=\"0.5\"" << std::endl;
preferencesFile << "testFileGetFloat=\"0.25\"" << std::endl;
preferencesFile << "testFileGetBoolean=\"true\"" << std::endl;
preferencesFile << "testFileGetLong=\"1000000000000000000\"" << std::endl;
preferencesFile.close();
Preferences *preferences = Preferences::GetInstance();
EXPECT_EQ("Hello, preferences file", preferences->GetString("testFileGetString"));
EXPECT_EQ(1, preferences->GetInt("testFileGetInt"));
EXPECT_FLOAT_EQ(0.5, preferences->GetDouble("testFileGetDouble"));
EXPECT_FLOAT_EQ(0.25f, preferences->GetFloat("testFileGetFloat"));
EXPECT_TRUE(preferences->GetBoolean("testFileGetBoolean"));
EXPECT_EQ(1000000000000000000ll, preferences->GetLong("testFileGetLong"));
Preferences *preferences = Preferences::GetInstance();
EXPECT_EQ("Hello, preferences file",
preferences->GetString("testFileGetString"));
EXPECT_EQ(1, preferences->GetInt("testFileGetInt"));
EXPECT_FLOAT_EQ(0.5, preferences->GetDouble("testFileGetDouble"));
EXPECT_FLOAT_EQ(0.25f, preferences->GetFloat("testFileGetFloat"));
EXPECT_TRUE(preferences->GetBoolean("testFileGetBoolean"));
EXPECT_EQ(1000000000000000000ll, preferences->GetLong("testFileGetLong"));
}
/**
@@ -43,36 +45,32 @@ TEST(PreferencesTest, ReadPreferencesFromFile) {
* in wpilib-preferences.ini
*/
TEST(PreferencesTest, WritePreferencesToFile) {
Preferences *preferences = Preferences::GetInstance();
preferences->PutString("testFilePutString", "Hello, preferences file");
preferences->PutInt("testFilePutInt", 1);
preferences->PutDouble("testFilePutDouble", 0.5);
preferences->PutFloat("testFilePutFloat", 0.25f);
preferences->PutBoolean("testFilePutBoolean", true);
preferences->PutLong("testFilePutLong", 1000000000000000000ll);
preferences->Save();
Preferences *preferences = Preferences::GetInstance();
preferences->PutString("testFilePutString", "Hello, preferences file");
preferences->PutInt("testFilePutInt", 1);
preferences->PutDouble("testFilePutDouble", 0.5);
preferences->PutFloat("testFilePutFloat", 0.25f);
preferences->PutBoolean("testFilePutBoolean", true);
preferences->PutLong("testFilePutLong", 1000000000000000000ll);
preferences->Save();
Wait(kSaveTime);
Wait(kSaveTime);
static char const *kExpectedFileContents[] = {
"[Preferences]",
"testFileGetString=\"Hello, preferences file\"",
"testFileGetInt=\"1\"",
"testFileGetDouble=\"0.5\"",
"testFileGetFloat=\"0.25\"",
"testFileGetBoolean=\"true\"",
"testFileGetLong=\"1000000000000000000\""
};
static char const *kExpectedFileContents[] = {
"[Preferences]", "testFileGetString=\"Hello, preferences file\"",
"testFileGetInt=\"1\"", "testFileGetDouble=\"0.5\"",
"testFileGetFloat=\"0.25\"", "testFileGetBoolean=\"true\"",
"testFileGetLong=\"1000000000000000000\""};
std::ifstream preferencesFile(kFileName);
for(int i = 0; i < 7; i++) {
ASSERT_FALSE(preferencesFile.eof())
<< "Preferences file prematurely reached EOF";
std::ifstream preferencesFile(kFileName);
for (int i = 0; i < 7; i++) {
ASSERT_FALSE(preferencesFile.eof())
<< "Preferences file prematurely reached EOF";
std::string line;
std::getline(preferencesFile, line);
std::string line;
std::getline(preferencesFile, line);
ASSERT_EQ(kExpectedFileContents[i], line)
<< "A line in wpilib-preferences.ini was not correct";
}
ASSERT_EQ(kExpectedFileContents[i], line)
<< "A line in wpilib-preferences.ini was not correct";
}
}