Commit MetaInfo

Revisionda700d929ab51a0f80a3d5856f3e27e07bed404b (tree)
Time2022-11-23 19:18:10
AuthorSecT <grzegorzstarowicz@gmai...>
CommiterSecT

Log Message

Converted task 2020_01 def into 2021 definition format

Change Summary

Incremental Difference

diff -r 9234f7b13c50 -r da700d929ab5 Cpp/adventOfCode/main.cpp
--- a/Cpp/adventOfCode/main.cpp Wed Nov 23 11:10:21 2022 +0100
+++ b/Cpp/adventOfCode/main.cpp Wed Nov 23 11:18:10 2022 +0100
@@ -39,15 +39,7 @@
3939 //task_2020_03();
4040 //task_2020_04();
4141 //task_2020_05();
42-
43- //TaskRunner task2020_05(2020,5);
44- //task2020_05.run();
45-
4642 //task_2020_06();
47- //
48- //TaskRunner task2020_06(2020,6);
49- //task2020_06.run();
50-
5143 //task_2020_07();
5244
5345
@@ -57,32 +49,38 @@
5749 cout<<"Running 2020 tasks..."<<endl;
5850 cout<<endl;
5951
52+ Task_2020_01 task2020_01_t;
53+ task2020_01_t.disableExample(0);
54+ task2020_01_t.disableExample(1);
55+ task_runner.setTaskToRun(&task2020_01_t, 2020, 1);
56+ task_runner.run();
57+
6058 Task_2020_02 task2020_02_t;
6159 task2020_02_t.disableExample(0);
6260 task2020_02_t.disableExample(1);
63- task_runner.setTaskToRun(&task2020_02_t, 2020,2);
61+ task_runner.setTaskToRun(&task2020_02_t, 2020, 2);
6462 task_runner.run();
6563
6664 Task_2020_03 task2020_03_t;
6765 task2020_03_t.disableExample(0);
6866 task2020_03_t.disableExample(1);
69- task_runner.setTaskToRun(&task2020_03_t, 2020,3);
67+ task_runner.setTaskToRun(&task2020_03_t, 2020, 3);
7068 task_runner.run();
7169
7270 Task_2020_04 task2020_04_t;
7371 task2020_04_t.disableExample(1);
74- task_runner.setTaskToRun(&task2020_04_t, 2020,4);
72+ task_runner.setTaskToRun(&task2020_04_t, 2020, 4);
7573 task_runner.run();
7674
7775 Task_2020_05 task2020_05_t;
7876 task2020_05_t.disableExample(0);
7977 task2020_05_t.disableExample(1);
80- task_runner.setTaskToRun(&task2020_05_t, 2020,5);
78+ task_runner.setTaskToRun(&task2020_05_t, 2020, 5);
8179 task_runner.run();
8280
8381 Task_2020_06 task2020_06_t;
8482 //task2020_06_t.disableSubtask(0);
85- task_runner.setTaskToRun(&task2020_06_t, 2020,6);
83+ task_runner.setTaskToRun(&task2020_06_t, 2020, 6);
8684 task_runner.run();
8785
8886
@@ -92,23 +90,23 @@
9290
9391
9492 Task_2021_01 task2021_01;
95- task_runner.setTaskToRun(&task2021_01, 2021,1);
93+ task_runner.setTaskToRun(&task2021_01, 2021, 1);
9694 task_runner.run();
9795
9896 Task_2021_02 task2021_02;
99- task_runner.setTaskToRun(&task2021_02, 2021,2);
97+ task_runner.setTaskToRun(&task2021_02, 2021, 2);
10098 task_runner.run();
10199
102100 Task_2021_03 task2021_03;
103- task_runner.setTaskToRun(&task2021_03, 2021,3);
101+ task_runner.setTaskToRun(&task2021_03, 2021, 3);
104102 task_runner.run();
105103
106104 Task_2021_04 task2021_04;
107- task_runner.setTaskToRun(&task2021_04, 2021,4);
105+ task_runner.setTaskToRun(&task2021_04, 2021, 4);
108106 task_runner.run();
109107
110108 Task_2021_05 task2021_05;
111- task_runner.setTaskToRun(&task2021_05, 2021,5);
109+ task_runner.setTaskToRun(&task2021_05, 2021, 5);
112110 task_runner.run();
113111
114112
diff -r 9234f7b13c50 -r da700d929ab5 Cpp/adventOfCode/main.h
--- a/Cpp/adventOfCode/main.h Wed Nov 23 11:10:21 2022 +0100
+++ b/Cpp/adventOfCode/main.h Wed Nov 23 11:18:10 2022 +0100
@@ -15,45 +15,45 @@
1515
1616
1717
18-bool task_2020_01()
19-{
20- std::vector<std::string> inputData;
21- string filePath = "input_2020_Task_01.txt";
22- if(!readLinesFromFileToVector(inputData, filePath))
23- {
24- cout<<"Error reading file: "<<filePath<<endl;
25- return false;
26- }
27-
28- if(!testReadingFileForTask_2020_01(inputData))
29- {
30- cout<<"File reading test failed!"<<endl;
31- return false;
32- }
33-
34- int result_task_2020_01_A = processTask_2020_01_A(inputData);
35-
36- if(!testTask_2020_01_A(result_task_2020_01_A))
37- {
38- cout<<"task 2020 01 A failed!"<<endl;
39- return false;
40- }
41-
42- cout<<"Task 2020 01 A result: "<<result_task_2020_01_A<<endl;
43-
44-
45- int result_task_2020_01_B = processTask_2020_01_B(inputData);
46-
47- if(!testTask_2020_01_B(result_task_2020_01_B))
48- {
49- cout<<"task 2020 01 B failed!"<<endl;
50- return false;
51- }
52-
53- cout<<"Task 2020 01 B result: "<<result_task_2020_01_B<<endl;
54-
55- return true;
56-}
18+//bool task_2020_01()
19+//{
20+// std::vector<std::string> inputData;
21+// string filePath = "input_2020_Task_01.txt";
22+// if(!readLinesFromFileToVector(inputData, filePath))
23+// {
24+// cout<<"Error reading file: "<<filePath<<endl;
25+// return false;
26+// }
27+//
28+// if(!testReadingFileForTask_2020_01(inputData))
29+// {
30+// cout<<"File reading test failed!"<<endl;
31+// return false;
32+// }
33+//
34+// int result_task_2020_01_A = processTask_2020_01_A(inputData);
35+//
36+// if(!testTask_2020_01_A(result_task_2020_01_A))
37+// {
38+// cout<<"task 2020 01 A failed!"<<endl;
39+// return false;
40+// }
41+//
42+// cout<<"Task 2020 01 A result: "<<result_task_2020_01_A<<endl;
43+//
44+//
45+// int result_task_2020_01_B = processTask_2020_01_B(inputData);
46+//
47+// if(!testTask_2020_01_B(result_task_2020_01_B))
48+// {
49+// cout<<"task 2020 01 B failed!"<<endl;
50+// return false;
51+// }
52+//
53+// cout<<"Task 2020 01 B result: "<<result_task_2020_01_B<<endl;
54+//
55+// return true;
56+//}
5757
5858 //bool task_2020_02()
5959 //{
diff -r 9234f7b13c50 -r da700d929ab5 Cpp/adventOfCode/tasks.cpp
--- a/Cpp/adventOfCode/tasks.cpp Wed Nov 23 11:10:21 2022 +0100
+++ b/Cpp/adventOfCode/tasks.cpp Wed Nov 23 11:18:10 2022 +0100
@@ -62,7 +62,7 @@
6262 return result == 287503934;
6363 }
6464
65-int processTask_2020_01_A(std::vector<std::string>& inputData)
65+int Task_2020_01::processTask_A(std::vector<std::string>& inputData)
6666 {
6767 int result = 0;
6868
@@ -83,7 +83,7 @@
8383 return result;
8484 }
8585
86-int processTask_2020_01_B(std::vector<std::string>& inputData)
86+int Task_2020_01::processTask_B(std::vector<std::string>& inputData)
8787 {
8888 int result = 0;
8989
diff -r 9234f7b13c50 -r da700d929ab5 Cpp/adventOfCode/tasks.h
--- a/Cpp/adventOfCode/tasks.h Wed Nov 23 11:10:21 2022 +0100
+++ b/Cpp/adventOfCode/tasks.h Wed Nov 23 11:18:10 2022 +0100
@@ -92,6 +92,26 @@
9292 };
9393
9494
95+class Task_2020_01 : public Task
96+{
97+public:
98+ Task_2020_01(){
99+ testValuesForInputFile[0] = "1686";
100+ testValuesForInputFile[1] = "1337";
101+ testValuesForInputFile[2] = "1862";
102+
103+ testValuesForExamples[0] = 7;
104+ testValuesForExamples[1] = 5;
105+
106+ testValuesForTask[0] = 955584;
107+ testValuesForTask[1] = 287503934;
108+
109+ }
110+
111+ virtual int processTask_A(std::vector<string>& inputData);
112+ virtual int processTask_B(std::vector<string>& inputData);
113+};
114+
95115 class Task_2020_02 : public Task
96116 {
97117 public:
@@ -376,11 +396,11 @@
376396 };
377397
378398 ///////////////////////////////////////TASK 2020 01////////////////////////////////////////////////////////
379-bool testReadingFileForTask_2020_01(std::vector<string>& inputData);
380-bool testTask_2020_01_A(int result);
381-bool testTask_2020_01_B(int result);
382-int processTask_2020_01_A(std::vector<std::string>& inputData);
383-int processTask_2020_01_B(std::vector<std::string>& inputData);
399+//bool testReadingFileForTask_2020_01(std::vector<string>& inputData);
400+//bool testTask_2020_01_A(int result);
401+//bool testTask_2020_01_B(int result);
402+//int processTask_2020_01_A(std::vector<std::string>& inputData);
403+//int processTask_2020_01_B(std::vector<std::string>& inputData);
384404
385405 ///////////////////////////////////////TASK 2020 02////////////////////////////////////////////////////////
386406 //bool testReadingFileForTask_2020_02(std::vector<string>& inputData);
Show on old repository browser