Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
basvodde committed Jun 8, 2010
1 parent 8192800 commit ad1c0e4
Show file tree
Hide file tree
Showing 35 changed files with 1,055 additions and 1,137 deletions.
8 changes: 6 additions & 2 deletions .settings/org.eclipse.cdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Tue Dec 29 09:23:19 SGT 2009
#Mon Jun 07 17:30:05 SGT 2010
eclipse.preferences.version=1
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
Expand Down Expand Up @@ -67,6 +67,7 @@ org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initial
org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
Expand All @@ -87,6 +88,7 @@ org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initia
org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
Expand Down Expand Up @@ -119,6 +121,7 @@ org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch=inser
org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
Expand All @@ -134,13 +137,14 @@ org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for=do not inser
org.eclipse.cdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line=true
org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line=true
org.eclipse.cdt.core.formatter.lineSplit=80
org.eclipse.cdt.core.formatter.lineSplit=200
org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.cdt.core.formatter.tabulation.char=tab
Expand Down
12 changes: 4 additions & 8 deletions src/CppUTest/CommandLineArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
#include "CppUTest/PlatformSpecificFunctions.h"

CommandLineArguments::CommandLineArguments(int ac, const char** av) :
ac_(ac), av_(av), verbose_(false), repeat_(1), groupFilter_(
""), nameFilter_(""), outputType_(OUTPUT_ECLIPSE)
ac_(ac), av_(av), verbose_(false), repeat_(1), groupFilter_(""), nameFilter_(""), outputType_(OUTPUT_ECLIPSE)
{
}

Expand All @@ -48,10 +47,8 @@ bool CommandLineArguments::parse(TestPlugin* plugin)
else if (argument.startsWith("-r")) SetRepeatCount(ac_, av_, i);
else if (argument.startsWith("-g")) SetGroupFilter(ac_, av_, i);
else if (argument.startsWith("-n")) SetNameFilter(ac_, av_, i);
else if (argument.startsWith("-o")) correctParameters = SetOutputType(
ac_, av_, i);
else if (argument.startsWith("-p")) correctParameters
= plugin->parseArguments(ac_, av_, i);
else if (argument.startsWith("-o")) correctParameters = SetOutputType(ac_, av_, i);
else if (argument.startsWith("-p")) correctParameters = plugin->parseArguments(ac_, av_, i);
else correctParameters = false;

if (correctParameters == false) {
Expand Down Expand Up @@ -101,8 +98,7 @@ void CommandLineArguments::SetRepeatCount(int ac, const char** av, int& i)

}

SimpleString CommandLineArguments::getParameterField(int ac, const char** av,
int& i)
SimpleString CommandLineArguments::getParameterField(int ac, const char** av, int& i)
{
SimpleString parameter(av[i]);
if (parameter.size() > 2) return av[i] + 2;
Expand Down
4 changes: 1 addition & 3 deletions src/CppUTest/CommandLineTestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
#include "CppUTest/JUnitTestOutput.h"
#include "CppUTest/TestRegistry.h"

CommandLineTestRunner::CommandLineTestRunner(int ac, const char** av,
TestOutput* output) :
CommandLineTestRunner::CommandLineTestRunner(int ac, const char** av, TestOutput* output) :
output_(output), jUnitOutput_(new JUnitTestOutput)
{
arguments_ = new CommandLineArguments(ac, av);
Expand All @@ -55,7 +54,6 @@ int CommandLineTestRunner::RunAllTests(int ac, const char** av)
ConsoleTestOutput output;

MemoryLeakWarningPlugin memLeakWarn(DEF_PLUGIN_MEM_LEAK);
//memLeakWarn.disable();
TestRegistry::getCurrentRegistry()->installPlugin(&memLeakWarn);

{
Expand Down
29 changes: 9 additions & 20 deletions src/CppUTest/Failure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,23 @@
#include "CppUTest/Failure.h"
#include "CppUTest/TestOutput.h"

Failure::Failure(Utest* test, const char* fileName, int lineNumber,
const SimpleString& theMessage) :
testName_(test->getFormattedName()), fileName_(fileName), lineNumber_(
lineNumber), message_(theMessage)
Failure::Failure(Utest* test, const char* fileName, int lineNumber, const SimpleString& theMessage) :
testName_(test->getFormattedName()), fileName_(fileName), lineNumber_(lineNumber), message_(theMessage)
{
}

Failure::Failure(Utest* test, const SimpleString& theMessage) :
testName_(test->getFormattedName()), fileName_(test->getFile()), lineNumber_(
test->getLineNumber()), message_(theMessage)
testName_(test->getFormattedName()), fileName_(test->getFile()), lineNumber_(test->getLineNumber()), message_(theMessage)
{
}

Failure::Failure(Utest* test, const char* fileName, int lineNum) :
testName_(test->getFormattedName()), fileName_(fileName),
lineNumber_(lineNum), message_("no message")
testName_(test->getFormattedName()), fileName_(fileName), lineNumber_(lineNum), message_("no message")
{
}

Failure::Failure(const Failure& f) :
testName_(f.testName_), fileName_(f.fileName_), lineNumber_(f.lineNumber_),
message_(f.message_)
testName_(f.testName_), fileName_(f.fileName_), lineNumber_(f.lineNumber_), message_(f.message_)
{
}

Expand Down Expand Up @@ -78,24 +73,18 @@ SimpleString Failure::getMessage() const
return message_;
}

EqualsFailure::EqualsFailure(Utest* test, const char* fileName,
int lineNumber, const SimpleString& expected,
const SimpleString& actual) :
EqualsFailure::EqualsFailure(Utest* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual) :
Failure(test, fileName, lineNumber)
{

const char* format = "expected <%s>\n\tbut was <%s>";
message_ = StringFromFormat(format, expected.asCharString(),
actual.asCharString());
message_ = StringFromFormat(format, expected.asCharString(), actual.asCharString());
}

ContainsFailure::ContainsFailure(Utest* test, const char* fileName,
int lineNumber, const SimpleString& expected,
const SimpleString& actual) :
ContainsFailure::ContainsFailure(Utest* test, const char* fileName, int lineNumber, const SimpleString& expected, const SimpleString& actual) :
Failure(test, fileName, lineNumber)
{

const char* format = "actual <%s>\n\tdid not contain <%s>";
message_ = StringFromFormat(format, actual.asCharString(),
expected.asCharString());
message_ = StringFromFormat(format, actual.asCharString(), expected.asCharString());
}
16 changes: 6 additions & 10 deletions src/CppUTest/MemoryLeakAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
static char* checkedMalloc(size_t size)
{
char* mem = (char*) PlatformSpecificMalloc(size);
if (mem == 0)FAIL("malloc returned nul pointer");
if (mem == 0)
FAIL("malloc returned nul pointer");
return mem;
}

Expand All @@ -52,8 +53,7 @@ void MemoryLeakAllocator::setCurrentNewAllocator(MemoryLeakAllocator* allocator)

MemoryLeakAllocator* MemoryLeakAllocator::getCurrentNewAllocator()
{
if (currentNewAllocator == 0)
setCurrentNewAllocatorToDefault();
if (currentNewAllocator == 0) setCurrentNewAllocatorToDefault();
return currentNewAllocator;
}

Expand All @@ -69,8 +69,7 @@ void MemoryLeakAllocator::setCurrentNewArrayAllocator(MemoryLeakAllocator* alloc

MemoryLeakAllocator* MemoryLeakAllocator::getCurrentNewArrayAllocator()
{
if (currentNewArrayAllocator == 0)
setCurrentNewArrayAllocatorToDefault();
if (currentNewArrayAllocator == 0) setCurrentNewArrayAllocatorToDefault();
return currentNewArrayAllocator;
}

Expand All @@ -86,8 +85,7 @@ void MemoryLeakAllocator::setCurrentMallocAllocator(MemoryLeakAllocator* allocat

MemoryLeakAllocator* MemoryLeakAllocator::getCurrentMallocAllocator()
{
if (currentMallocAllocator == 0)
setCurrentMallocAllocatorToDefault();
if (currentMallocAllocator == 0) setCurrentMallocAllocatorToDefault();
return currentMallocAllocator;
}

Expand All @@ -106,13 +104,11 @@ char* MemoryLeakAllocator::allocMemoryLeakNode(size_t size)
return alloc_memory(size);
}

void MemoryLeakAllocator::freeMemoryLeakNode(char* memory)
void MemoryLeakAllocator::freeMemoryLeakNode(char* memory)
{
free_memory(memory);
}



char* StandardMallocAllocator::alloc_memory(size_t size)
{
return checkedMalloc(size);
Expand Down
Loading

0 comments on commit ad1c0e4

Please sign in to comment.