Skip to content

Commit 7e6f728

Browse files
committed
code formats
1 parent 7b12216 commit 7e6f728

File tree

11 files changed

+694
-792
lines changed

11 files changed

+694
-792
lines changed

src/AbstractList.hpp

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -316,72 +316,72 @@ class AbstractList {
316316
*/
317317
bool isEmpty() { return getSize() == 0; }
318318

319-
// /*!
320-
// * @brief Get an array which represent the list.
321-
// *
322-
// * @note If this list is empty, a nullptr will be returned.
323-
// * @note The memory for the array is dynamically allocated. the returned
324-
// * pointer has to be free'd with free() in order to prevent memory leaks. For
325-
// * further processing of the array, e.g. inserting new elements, the other
326-
// * method toArray(T* arr) is preferred!
327-
// * @note The array contains always immutable representations of the elements,
328-
// * saved in the list.
329-
// *
330-
// * @return Array representation of the list or nullptr if the list is
331-
// * empty.
332-
// */
333-
// T *toArray() {
334-
// if (getSize() == 0) {
335-
// return nullptr;
336-
// }
337-
//
338-
// T *arr = static_cast<T *>(malloc(getSize() * sizeof(T)));
339-
// this->toArray(arr);
340-
//
341-
// return arr;
342-
// }
343-
//
344-
// /*!
345-
// * @brief Fill the passed array with immutable objects.
346-
// *
347-
// * @note The array contains always immutable representations of the elements,
348-
// * saved in the list.
349-
// * @note Be sure, that the array has enough free space for all elements of the
350-
// * list.
351-
// *
352-
// * @param arr Array to fill.
353-
// */
354-
// void toArray(T *arr) {
355-
// for (int i = 0; i < getSize(); i++) {
356-
// arr[i] = get(i);
357-
// }
358-
// }
359-
//
360-
// /*!
361-
// * @brief Create the list from given array.
362-
// * @note Removes all entries in current list.
363-
// *
364-
// * @param arr Array
365-
// * @param arrSize Size of Array
366-
// */
367-
// void fromArray(T *arr, size_t arrSize) {
368-
// this->clear();
369-
// addAll(arr, arrSize);
370-
// }
371-
372-
// /*!
373-
// * @brief Sort the entries in the list with Quicksort.
374-
// *
375-
// * @param compFunc Comparator Method
376-
// */
377-
// void sort(int (*compFunc)(const void *, const void *)) {
378-
// T *arr = this->toArray();
379-
//
380-
// qsort(arr, getSize(), sizeof(*arr), compFunc);
381-
//
382-
// this->fromArray(arr, getSize());
383-
// free(arr);
384-
// }
319+
// /*!
320+
// * @brief Get an array which represent the list.
321+
// *
322+
// * @note If this list is empty, a nullptr will be returned.
323+
// * @note The memory for the array is dynamically allocated. the returned
324+
// * pointer has to be free'd with free() in order to prevent memory leaks. For
325+
// * further processing of the array, e.g. inserting new elements, the other
326+
// * method toArray(T* arr) is preferred!
327+
// * @note The array contains always immutable representations of the elements,
328+
// * saved in the list.
329+
// *
330+
// * @return Array representation of the list or nullptr if the list is
331+
// * empty.
332+
// */
333+
// T *toArray() {
334+
// if (getSize() == 0) {
335+
// return nullptr;
336+
// }
337+
//
338+
// T *arr = static_cast<T *>(malloc(getSize() * sizeof(T)));
339+
// this->toArray(arr);
340+
//
341+
// return arr;
342+
// }
343+
//
344+
// /*!
345+
// * @brief Fill the passed array with immutable objects.
346+
// *
347+
// * @note The array contains always immutable representations of the elements,
348+
// * saved in the list.
349+
// * @note Be sure, that the array has enough free space for all elements of the
350+
// * list.
351+
// *
352+
// * @param arr Array to fill.
353+
// */
354+
// void toArray(T *arr) {
355+
// for (int i = 0; i < getSize(); i++) {
356+
// arr[i] = get(i);
357+
// }
358+
// }
359+
//
360+
// /*!
361+
// * @brief Create the list from given array.
362+
// * @note Removes all entries in current list.
363+
// *
364+
// * @param arr Array
365+
// * @param arrSize Size of Array
366+
// */
367+
// void fromArray(T *arr, size_t arrSize) {
368+
// this->clear();
369+
// addAll(arr, arrSize);
370+
// }
371+
372+
// /*!
373+
// * @brief Sort the entries in the list with Quicksort.
374+
// *
375+
// * @param compFunc Comparator Method
376+
// */
377+
// void sort(int (*compFunc)(const void *, const void *)) {
378+
// T *arr = this->toArray();
379+
//
380+
// qsort(arr, getSize(), sizeof(*arr), compFunc);
381+
//
382+
// this->fromArray(arr, getSize());
383+
// free(arr);
384+
// }
385385

386386
/*!
387387
* @brief Compare two lists whether their attributes and entries are equal.

test/test_immutable_+/test_immutable_+.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
// ---------- In different scope (ds) ---------- //
88

9-
void add_ds_rvalue_primitive(void)
10-
{
9+
void add_ds_rvalue_primitive(void) {
1110
List<int> list;
1211

1312
{
@@ -24,8 +23,7 @@ void add_ds_rvalue_primitive(void)
2423
TEST_ASSERT_EQUAL_INT(2, list.getSize());
2524
}
2625

27-
void add_ds_lvalue_primitive(void)
28-
{
26+
void add_ds_lvalue_primitive(void) {
2927
List<int> list;
3028

3129
{
@@ -50,8 +48,7 @@ void add_ds_lvalue_primitive(void)
5048
TEST_ASSERT_EQUAL_INT(2, list.getSize());
5149
}
5250

53-
void add_ds_rvalue_class(void)
54-
{
51+
void add_ds_rvalue_class(void) {
5552
List<String> list;
5653

5754
{
@@ -68,8 +65,7 @@ void add_ds_rvalue_class(void)
6865
TEST_ASSERT_EQUAL_INT(2, list.getSize());
6966
}
7067

71-
void add_ds_lvalue_class(void)
72-
{
68+
void add_ds_lvalue_class(void) {
7369
List<String> list;
7470

7571
{
@@ -96,8 +92,7 @@ void add_ds_lvalue_class(void)
9692

9793
// ---------- In same scope (ss) ---------- //
9894

99-
void add_ss_rvalue_primitive(void)
100-
{
95+
void add_ss_rvalue_primitive(void) {
10196
List<int> list;
10297

10398
list + 1;
@@ -110,8 +105,7 @@ void add_ss_rvalue_primitive(void)
110105
TEST_ASSERT_EQUAL_INT(2, list.getSize());
111106
}
112107

113-
void add_ss_lvalue_primitive(void)
114-
{
108+
void add_ss_lvalue_primitive(void) {
115109
List<int> list;
116110

117111
int a = 1, b = 2;
@@ -132,8 +126,7 @@ void add_ss_lvalue_primitive(void)
132126
TEST_ASSERT_EQUAL_INT(2, list.getSize());
133127
}
134128

135-
void add_ss_rvalue_class(void)
136-
{
129+
void add_ss_rvalue_class(void) {
137130
List<String> list;
138131

139132
list + "1";
@@ -146,8 +139,7 @@ void add_ss_rvalue_class(void)
146139
TEST_ASSERT_EQUAL_INT(2, list.getSize());
147140
}
148141

149-
void add_ss_lvalue_class(void)
150-
{
142+
void add_ss_lvalue_class(void) {
151143
List<String> list;
152144

153145
String a = "1", b = "2";
@@ -170,8 +162,7 @@ void add_ss_lvalue_class(void)
170162

171163
// ---------- void operator+(AbstractList<T> &list) ---------- //
172164

173-
void addAll_primitive(void)
174-
{
165+
void addAll_primitive(void) {
175166
List<int> fromList;
176167
List<int> toList;
177168

@@ -200,8 +191,7 @@ void addAll_primitive(void)
200191
TEST_ASSERT_EQUAL_INT(6, toList.getSize());
201192
}
202193

203-
void addAll_class(void)
204-
{
194+
void addAll_class(void) {
205195
List<String> fromList;
206196
List<String> toList;
207197

@@ -230,8 +220,7 @@ void addAll_class(void)
230220
TEST_ASSERT_EQUAL_INT(6, toList.getSize());
231221
}
232222

233-
void setup()
234-
{
223+
void setup() {
235224
UNITY_BEGIN();
236225

237226
// different scope tests
@@ -253,6 +242,5 @@ void setup()
253242
UNITY_END();
254243
}
255244

256-
void loop()
257-
{
245+
void loop() {
258246
}

test/test_immutable_add/test_immutable_add.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
// ---------- In different scope (ds) ---------- //
88

9-
void add_ds_rvalue_primitive(void)
10-
{
9+
void add_ds_rvalue_primitive(void) {
1110
List<int> list;
1211

1312
{
@@ -24,8 +23,7 @@ void add_ds_rvalue_primitive(void)
2423
TEST_ASSERT_EQUAL_INT(2, list.getSize());
2524
}
2625

27-
void add_ds_lvalue_primitive(void)
28-
{
26+
void add_ds_lvalue_primitive(void) {
2927
List<int> list;
3028

3129
{
@@ -50,8 +48,7 @@ void add_ds_lvalue_primitive(void)
5048
TEST_ASSERT_EQUAL_INT(2, list.getSize());
5149
}
5250

53-
void add_ds_rvalue_class(void)
54-
{
51+
void add_ds_rvalue_class(void) {
5552
List<String> list;
5653

5754
{
@@ -68,8 +65,7 @@ void add_ds_rvalue_class(void)
6865
TEST_ASSERT_EQUAL_INT(2, list.getSize());
6966
}
7067

71-
void add_ds_lvalue_class(void)
72-
{
68+
void add_ds_lvalue_class(void) {
7369
List<String> list;
7470

7571
{
@@ -96,8 +92,7 @@ void add_ds_lvalue_class(void)
9692

9793
// ---------- In same scope (ss) ---------- //
9894

99-
void add_ss_rvalue_primitive(void)
100-
{
95+
void add_ss_rvalue_primitive(void) {
10196
List<int> list;
10297

10398
list.add(1);
@@ -110,8 +105,7 @@ void add_ss_rvalue_primitive(void)
110105
TEST_ASSERT_EQUAL_INT(2, list.getSize());
111106
}
112107

113-
void add_ss_lvalue_primitive(void)
114-
{
108+
void add_ss_lvalue_primitive(void) {
115109
List<int> list;
116110

117111
int a = 1, b = 2;
@@ -134,8 +128,7 @@ void add_ss_lvalue_primitive(void)
134128
TEST_ASSERT_EQUAL_INT(2, list.getSize());
135129
}
136130

137-
void add_ss_rvalue_class(void)
138-
{
131+
void add_ss_rvalue_class(void) {
139132
List<String> list;
140133

141134
list.add("1");
@@ -148,8 +141,7 @@ void add_ss_rvalue_class(void)
148141
TEST_ASSERT_EQUAL_INT(2, list.getSize());
149142
}
150143

151-
void add_ss_lvalue_class(void)
152-
{
144+
void add_ss_lvalue_class(void) {
153145
List<String> list;
154146

155147
String a = "1", b = "2";
@@ -170,8 +162,7 @@ void add_ss_lvalue_class(void)
170162
TEST_ASSERT_EQUAL_INT(2, list.getSize());
171163
}
172164

173-
void setup()
174-
{
165+
void setup() {
175166
UNITY_BEGIN();
176167

177168
// different scope tests
@@ -189,6 +180,5 @@ void setup()
189180
UNITY_END();
190181
}
191182

192-
void loop()
193-
{
183+
void loop() {
194184
}

0 commit comments

Comments
 (0)