From fa01a0a86648abf6f76278722277dab117880919 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Sun, 14 Apr 2024 07:05:05 +0200 Subject: [PATCH 1/3] Fix tape printing --- src/tape.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tape.jl b/src/tape.jl index 1439dede..d957618c 100644 --- a/src/tape.jl +++ b/src/tape.jl @@ -110,7 +110,7 @@ function Base.show(io::IO, instruction::AbstractInstruction, pad = "") end function Base.show(io::IO, tp::InstructionTape) - println("$(length(tp))-element InstructionTape:") + println(io, "$(length(tp))-element InstructionTape:") i = 1 for instruction in tp print(io, "$i => ") From d1fc4b699eaa1c18bfd4a65f1e2d6144b05f7bb6 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Sun, 14 Apr 2024 10:28:48 +0200 Subject: [PATCH 2/3] Update tape.jl Co-authored-by: David Widmann --- src/tape.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tape.jl b/src/tape.jl index d957618c..afaf8770 100644 --- a/src/tape.jl +++ b/src/tape.jl @@ -110,7 +110,7 @@ function Base.show(io::IO, instruction::AbstractInstruction, pad = "") end function Base.show(io::IO, tp::InstructionTape) - println(io, "$(length(tp))-element InstructionTape:") + println(io, length(tp), "-element InstructionTape:") i = 1 for instruction in tp print(io, "$i => ") From f5ce5fb39925f7fa1fe7df8c44531ff09b087925 Mon Sep 17 00:00:00 2001 From: Guillaume Dalle <22795598+gdalle@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:07:22 +0200 Subject: [PATCH 3/3] Add string test --- test/TapeTests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/TapeTests.jl b/test/TapeTests.jl index 70cb0043..1a8f2ed0 100644 --- a/test/TapeTests.jl +++ b/test/TapeTests.jl @@ -31,6 +31,7 @@ for Instr in (SpecialInstruction, ScalarInstruction) @test tp[1].input[2] == y @test tp[1].output === z @test tp[1].cache === c + @test startswith(string(tp), "1-element InstructionTape:") ReverseDiff.record!(NULL_TAPE, Instr, +, (x, y, k), z, c) @test isempty(NULL_TAPE)