Skip to content

Commit

Permalink
Introduce new passthrough judge
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloop committed Apr 19, 2018
1 parent f4600b9 commit 72f6cb4
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions judges/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ cmake_minimum_required(VERSION 2.8)

# Just add all judges and nothing else
add_subdirectory(codex_judge)
add_subdirectory(judge_passthrough)
add_subdirectory(filter)
add_subdirectory(shuffled)
25 changes: 25 additions & 0 deletions judges/judge_passthrough/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.8)
project(recodex-judge-passthrough)

# Use all settings from original Makefile
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -fexceptions")
set(CMAKE_CXX_LINKER_FLAGS "${CMAKE_CXX_LINKER_FLAGS} -s")
endif()

# The worker executable
set(SOURCE_FILES
main.cpp
)

add_executable(${PROJECT_NAME} ${SOURCE_FILES})


# installation
if(UNIX)
install(TARGETS recodex-judge-passthrough DESTINATION /usr/bin COMPONENT binaries)
elseif(MSVC)
install(TARGETS recodex-judge-passthrough DESTINATION worker/bin COMPONENT binaries)
else()
install(TARGETS recodex-judge-passthrough DESTINATION recodex/worker/bin COMPONENT binaries)
endif()
39 changes: 39 additions & 0 deletions judges/judge_passthrough/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Passthrough judge which just outputs inputted file.
* (C) 2018 ReCodEx Team <github.com/ReCodEx>
*
* Usage: recodex-judge-passthrough <file> <file>
*
* Exitcode:
* - 0: if output was provided
* - 2: errors were present during execution of comparision, error message should be visible on stderr
*
* Enjoy :o)
*/

#include <iostream>
#include <fstream>

#define RES_OK 0
#define RES_ERROR 2

using namespace std;


/*
* Application entry point.
*/
int main(int argc, char **argv) {

// Check amount of program arguments.
if (argc != 3) {
cerr << "Wrong amount of arguments." << endl;
return RES_ERROR;
}

ifstream inputfile(argv[1]);
cout << inputfile.rdbuf();
inputfile.close();

return RES_OK;
}

0 comments on commit 72f6cb4

Please sign in to comment.