fix: remove combined test case files
This commit is contained in:
parent
5f236153cc
commit
66b7db6da4
3 changed files with 6 additions and 26 deletions
|
|
@ -60,11 +60,7 @@ M.defaults = {
|
||||||
setup_code = nil,
|
setup_code = nil,
|
||||||
},
|
},
|
||||||
debug = false,
|
debug = false,
|
||||||
scrapers = vim.iter(constants.PLATFORMS)
|
scrapers = constants.PLATFORMS,
|
||||||
:map(function(platform)
|
|
||||||
return platform, true
|
|
||||||
end)
|
|
||||||
:totable(),
|
|
||||||
filename = nil,
|
filename = nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ local function setup_problem(contest_id, problem_id, language)
|
||||||
|
|
||||||
local ctx = problem.create_context(state.platform, contest_id, problem_id, config, language)
|
local ctx = problem.create_context(state.platform, contest_id, problem_id, config, language)
|
||||||
|
|
||||||
if config.scrapers[state.platform] then
|
if vim.tbl_contains(config.scrapers, state.platform) then
|
||||||
local metadata_result = scrape.scrape_contest_metadata(state.platform, contest_id)
|
local metadata_result = scrape.scrape_contest_metadata(state.platform, contest_id)
|
||||||
if not metadata_result.success then
|
if not metadata_result.success then
|
||||||
logger.log(
|
logger.log(
|
||||||
|
|
@ -73,7 +73,7 @@ local function setup_problem(contest_id, problem_id, language)
|
||||||
state.test_cases = cached_test_cases
|
state.test_cases = cached_test_cases
|
||||||
end
|
end
|
||||||
|
|
||||||
if config.scrapers[state.platform] then
|
if vim.tbl_contains(config.scrapers, state.platform) then
|
||||||
local scrape_result = scrape.scrape_problem(ctx)
|
local scrape_result = scrape.scrape_problem(ctx)
|
||||||
|
|
||||||
if not scrape_result.success then
|
if not scrape_result.success then
|
||||||
|
|
@ -567,7 +567,7 @@ function M.handle_command(opts)
|
||||||
if cmd.type == "contest_setup" then
|
if cmd.type == "contest_setup" then
|
||||||
if set_platform(cmd.platform) then
|
if set_platform(cmd.platform) then
|
||||||
state.contest_id = cmd.contest
|
state.contest_id = cmd.contest
|
||||||
if config.scrapers[cmd.platform] then
|
if vim.tbl_contains(config.scrapers, cmd.platform) then
|
||||||
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, cmd.contest)
|
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, cmd.contest)
|
||||||
if not metadata_result.success then
|
if not metadata_result.success then
|
||||||
logger.log(
|
logger.log(
|
||||||
|
|
@ -590,7 +590,7 @@ function M.handle_command(opts)
|
||||||
local problem_ids = {}
|
local problem_ids = {}
|
||||||
local has_metadata = false
|
local has_metadata = false
|
||||||
|
|
||||||
if config.scrapers[cmd.platform] then
|
if vim.tbl_contains(config.scrapers, cmd.platform) then
|
||||||
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, cmd.contest)
|
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, cmd.contest)
|
||||||
if not metadata_result.success then
|
if not metadata_result.success then
|
||||||
logger.log(
|
logger.log(
|
||||||
|
|
@ -633,7 +633,7 @@ function M.handle_command(opts)
|
||||||
|
|
||||||
if cmd.type == "cses_problem" then
|
if cmd.type == "cses_problem" then
|
||||||
if set_platform(cmd.platform) then
|
if set_platform(cmd.platform) then
|
||||||
if config.scrapers[cmd.platform] then
|
if vim.tbl_contains(config.scrapers, cmd.platform) then
|
||||||
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, "")
|
local metadata_result = scrape.scrape_contest_metadata(cmd.platform, "")
|
||||||
if not metadata_result.success then
|
if not metadata_result.success then
|
||||||
logger.log(
|
logger.log(
|
||||||
|
|
|
||||||
|
|
@ -273,22 +273,6 @@ function M.scrape_problem(ctx)
|
||||||
vim.fn.writefile(vim.split(input_content, "\n", true), input_file)
|
vim.fn.writefile(vim.split(input_content, "\n", true), input_file)
|
||||||
vim.fn.writefile(vim.split(expected_content, "\n", true), expected_file)
|
vim.fn.writefile(vim.split(expected_content, "\n", true), expected_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
local combined_input = table.concat(
|
|
||||||
vim.tbl_map(function(tc)
|
|
||||||
return tc.input
|
|
||||||
end, data.tests),
|
|
||||||
"\n"
|
|
||||||
)
|
|
||||||
local combined_output = table.concat(
|
|
||||||
vim.tbl_map(function(tc)
|
|
||||||
return tc.expected
|
|
||||||
end, data.tests),
|
|
||||||
"\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.fn.writefile(vim.split(combined_input, "\n", true), ctx.input_file)
|
|
||||||
vim.fn.writefile(vim.split(combined_output, "\n", true), ctx.expected_file)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue