feat: context, not config

This commit is contained in:
Barrett Ruth 2025-09-24 18:21:34 -04:00
parent a0171ee81e
commit 9e84d57b8a
15 changed files with 209 additions and 328 deletions

View file

@ -88,20 +88,22 @@ describe('Panel integration', function()
state.set_contest_id('2146')
state.set_problem_id('b')
local problem = require('cp.problem')
local config_module = require('cp.config')
local processed_config = config_module.setup({
contests = { codeforces = { cpp = { extension = 'cpp' } } },
})
local ctx = problem.create_context('codeforces', '2146', 'b', processed_config)
local cp_state = require('cp.state')
cp_state.set_platform('codeforces')
cp_state.set_contest_id('2146')
cp_state.set_problem_id('b')
assert.has_no_errors(function()
run.load_test_cases(ctx, state)
run.load_test_cases(state)
end)
local fake_state_data = { platform = 'codeforces', contest_id = '2146', problem_id = 'b' }
assert.has_errors(function()
run.load_test_cases(ctx, fake_state_data)
run.load_test_cases(fake_state_data)
end)
end)
end)