JamesBremner / Agents2Tasks

Assign agents to tasks in multiple timeslots
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Unit test fails when run from a command prompt #29

Closed rejkid closed 12 months ago

rejkid commented 12 months ago

Does Agents2Tasks.exe replace Agents2TasksConsole.exe I can't see the target in makefile to build console app

JamesBremner commented 12 months ago

Yes

rejkid commented 12 months ago

I am getting this output with the input ex27j.txt

C:\ScheduleMeWorkspace\ScheduleMeBackEnd>C:\ScheduleMeWorkspace\ScheduleMeBackEnd\Agents2Tasks.exe ./Upload/ex27j.txt ./Upload/a2t_result.txt terminate called after throwing an instance of 'std::runtime_error' what(): 16 1 unit test failed

JamesBremner commented 12 months ago

Here is the unit test code

https://github.com/JamesBremner/Agents2Tasks/blob/bf2585c7989b511f2aeb7d0d00e8ad343e8d5cc9/src/unitTest.cpp#L11-L34

Run under the debugger and see what the difference between expected and result is

JamesBremner commented 12 months ago

The unit tests do not depend on the input. A unit test failure indicates a build error. My best guess is that you are not building from the latest commit. Please post a screenshot of the github desktop application. It should look like this:

image

rejkid commented 12 months ago

# image

JamesBremner commented 12 months ago

You need to show the history

rejkid commented 12 months ago

image

JamesBremner commented 12 months ago

That looks good.

What do you get from the debugger?

JamesBremner commented 12 months ago

You should also post the complete build log.

Executing task: C:\Users\James\code_ext\msys64\mingw64\bin\mingw32-make.exe -f .vscode/makefile a2t

g++ ./src/main.cpp  \
-c -o .vscode/obj/main.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ ./src/input.cpp  \
-c -o .vscode/obj/input.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ ./src/cAgent.cpp  \
-c -o .vscode/obj/cAgent.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ ./src/cTask.cpp  \
-c -o .vscode/obj/cTask.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ ./src/cSlot.cpp  \
-c -o .vscode/obj/cSlot.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ ./src/cAssign.cpp  \
-c -o .vscode/obj/cAssign.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ ./src/unitTest.cpp  \
-c -o .vscode/obj/unitTest.o  -I./include -I../raven-set  -std=c++17 -g -D_mingw_
g++ -g \
-o bin/Agents2Tasks.exe .vscode/obj/main.o .vscode/obj/input.o .vscode/obj/cAgent.o .vscode/obj/cTask.o .vscode/obj/cSlot.o .vscode/obj/cAssign.o .vscode/obj/unitTest.o  \
-static-libstdc++ -static-libgcc -static -lComctl32 -lgdiplus -lgdi32 -lcomdlg32 -lstdc++fs
 *  Terminal will be reused by tasks, press any key to close it. 
JamesBremner commented 12 months ago

I can reproduce this!

rejkid commented 12 months ago

I don't know how to run debugger for cpp in VC. I have never done it before

JamesBremner commented 12 months ago

Press key F5 to run under debugger

rejkid commented 12 months ago

I did and I get this dialog box: image ... I pressed "Install cppdbg Extension" and it says "No extension found"

JamesBremner commented 12 months ago

You will have to ask a VSCODE forum about that

JamesBremner commented 12 months ago

Cause: std::stable_sort() appears not to be working as expected. It seems that the order of equivalent agents is not stable, but random.

rejkid commented 12 months ago

is it fixable ?

JamesBremner commented 12 months ago

I have labelled this issue 'accepted' That means I am working on it. You can find the meaning of any label by hovering the mouse cursor over the label.

rejkid commented 12 months ago

The Agents2Tasks.exe is passing all unit tests for input file ex27j.txt and generates the output file.