Skip to content

Commit af3795f

Browse files
committed
1 parent d228f97 commit af3795f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: src/Chuffed.jl

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ module FZN
1313
include("FlatZincOptimizer.jl")
1414
end
1515

16+
function run_chuffed(args)
17+
io = IOBuffer()
18+
Chuffed_jll.fznchuffed() do exe
19+
return run(pipeline(`$(exe) $(args)`; stdout = io))
20+
end
21+
seekstart(io)
22+
return String(take!(io))
23+
end
24+
1625
function Optimizer(; stdin::IO=stdin, stdout::IO=stdout)
1726
return FZN.Optimizer(Chuffed_jll.run_chuffed; stdin=stdin, stdout=stdout)
1827
end

Diff for: test/parsing.jl

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
@testset "Parsing FlatZinc output format" begin
2-
2+
@testset "puzzle.fzn" begin
3+
in_file_name = @__DIR__() * "/assets/puzzle.fzn"
4+
out_string = Chuffed.run_chuffed(in_file_name)
5+
@show out_string
6+
@show Chuffed.FZN._parse_to_fznresults(out_string)
7+
end
38
end

0 commit comments

Comments
 (0)