Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mainwindow): use simplified instead of trimmed in diff #39

Merged
merged 1 commit into from
Dec 13, 2019

Conversation

ouuan
Copy link
Member

@ouuan ouuan commented Dec 13, 2019

This partially fixes #38.

@caretaker-claire
Copy link

Hi ouuan
Thank you for your contribution to cp-editor2. I will request a review from one of the contributor. Once they approves and all CI checks passes, I will merge your Pull Request.

@coder3101
Copy link
Member

coder3101 commented Dec 13, 2019

https://doc.qt.io/qt-5/qstring.html#simplified

According to docs this function replaces \n characters. So it basically makes everything one line, every multiline output is converted into one line output. So now following are same :

2
4 
6

and

2 4 6

While this is obviously Wrong answer on Codeforces or any other platforms.

Reverted the commit, Please open a new PR fixing this issue (We need to manually implement that function I talked about in #38)

@ouuan
Copy link
Member Author

ouuan commented Dec 13, 2019

https://doc.qt.io/qt-5/qstring.html#simplified

According to docs this function replaces \n characters. So it basically makes everything one line, every multiline output is converted into one line output. So now following are same :

2
4 
6

and

2 4 6

While this is obviously Wrong answer on Codeforces or any other platforms.

Reverted the commit, Please open a new PR fixing this issue (We need to manually implement that function I talked about in #38)

In other OJs this may be WA, but in most problems on CF, white spaces don't matter.

@ouuan
Copy link
Member Author

ouuan commented Dec 13, 2019

image

@ouuan ouuan deleted the fix-diff branch December 13, 2019 10:49
@coder3101
Copy link
Member

Yes, So people who use Codechef and other platforms will complain about it. It will be better if newlines are maintained.

@ouuan
Copy link
Member Author

ouuan commented Dec 13, 2019

Where should I write a function for comparing? It doesn't seem like a "member function".

(In fact, almost all functions returns void.)

@coder3101
Copy link
Member

Create a function with following signature in mainwindow.cc.

bool MainWindow::isVerdictPass(QString output, QString expected){...};

It should return true if verdict is AC otherwise false.
Create this after the definition of function launchSession().

Then you need to declare it as well, in mainwindow.hpp, just after launchSession(); declare it (private);

....
bool isVerdictPass (QString, QString);
...

Then replace that isSame with the value returned from this call, pass the arguments as expected.

@coder3101
Copy link
Member

Where should I write a function for comparing? It doesn't seem like a "member function".

(In fact, almost all functions returns void.)

Yes they are member function that behave like callbacks, callbacks usually have void return type. They are normal C++ classes and functions. No magic, you can do whatever you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use testlib.h to check the verdicts
2 participants