From 2681f19c194c3b3e98ad190efcbf88cb00dfa1df Mon Sep 17 00:00:00 2001 From: = Date: Wed, 27 Apr 2016 21:24:44 +0300 Subject: [PATCH] Fixed tests to match the new slightly different output --- src/config.jl | 1 + test/documents/FIR_design.jl | 5 +- test/documents/FIR_design_ref.md | 41 ++++-------- test/documents/chunk_func_ref.md | 4 +- test/documents/chunk_options_ref.md | 32 +++++----- test/documents/gadfly_markdown_test_ref.md | 4 +- test/documents/pyplot_formats_ref. | 74 ++++++++++++++++++++++ test/documents/pyplot_formats_ref.md | 27 +++++++- test/documents/pyplot_formats_ref.rst | 31 ++++++++- test/documents/pyplot_formats_ref.tex | 19 +++++- test/documents/test_hold_ref.md | 12 ++-- test/documents/winston_formats_ref.md | 7 ++ test/documents/winston_formats_ref.rst | 8 +++ test/documents/winston_formats_ref.tex | 15 +++-- test/documents/winston_formats_svg_ref.md | 17 +++-- 15 files changed, 224 insertions(+), 73 deletions(-) create mode 100644 test/documents/pyplot_formats_ref. diff --git a/src/config.jl b/src/config.jl index 7f6acb3..97810a5 100644 --- a/src/config.jl +++ b/src/config.jl @@ -61,6 +61,7 @@ julia> set_chunk_defaults(Dict{Symbol, Any}(:dpi => 200, fig_width => 8)) """ function set_chunk_defaults(opts::Dict{Symbol, Any}) merge!(rcParams[:chunk_defaults], opts) + return nothing end """ diff --git a/test/documents/FIR_design.jl b/test/documents/FIR_design.jl index 2a49c0d..2fd8cc0 100644 --- a/test/documents/FIR_design.jl +++ b/test/documents/FIR_design.jl @@ -64,11 +64,12 @@ h = FIRfreqz(f, w) #' ## Plot the frequency and impulse response +h_db = log10(abs(h)) +ws = w/pi*(fs/2) + #' The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax. #+ term=true -h_db = log10(abs(h)) -ws = w/pi*(fs/2) plot(y = h_db, x = ws, Geom.line, Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)")) diff --git a/test/documents/FIR_design_ref.md b/test/documents/FIR_design_ref.md index 3f63ae2..184efcf 100644 --- a/test/documents/FIR_design_ref.md +++ b/test/documents/FIR_design_ref.md @@ -75,42 +75,25 @@ h = FIRfreqz(f, w) ## Plot the frequency and impulse response + +~~~~{.julia} +h_db = log10(abs(h)) +ws = w/pi*(fs/2) +~~~~~~~~~~~~~ + + + + The next code chunk is executed in term mode, see the [script](FIR_design.jl) for syntax. ~~~~{.julia} julia> -h_db = log10(abs(h)) - -1024-element Array{Float32,1}: - 0.0 - -1.52727e-6 - -6.03147e-6 - -1.35386e-5 - -2.39452e-5 - -3.71738e-5 - -5.31213e-5 - -7.16583e-5 - -9.25781e-5 - -0.000115803 - ⋮ - -3.21659 - -3.18342 - -3.15605 - -3.13379 - -3.11615 - -3.10275 - -3.09335 - -3.08778 - -3.08593 -julia> ws = w/pi*(fs/2) - -linspace(0.0,10.0,1024) -julia> plot(y = h_db, x = ws, Geom.line, +plot(y = h_db, x = ws, Geom.line, Guide.xlabel("Frequency (Hz)"), Guide.ylabel("Magnitude (db)")) ~~~~~~~~~~~~~ -![](figures/FIR_design_3_1.png)\ +![](figures/FIR_design_4_1.png)\ @@ -124,5 +107,5 @@ plot(y = h_phase, x = ws, Geom.line, ~~~~~~~~~~~~~ -![](figures/FIR_design_4_1.png)\ +![](figures/FIR_design_5_1.png)\ diff --git a/test/documents/chunk_func_ref.md b/test/documents/chunk_func_ref.md index f886e6a..2f521e3 100644 --- a/test/documents/chunk_func_ref.md +++ b/test/documents/chunk_func_ref.md @@ -6,8 +6,8 @@ println(f(2)) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ 4 -~~~~~~~~~~~~~ +~~~~ diff --git a/test/documents/chunk_options_ref.md b/test/documents/chunk_options_ref.md index 7e8a653..72c8339 100644 --- a/test/documents/chunk_options_ref.md +++ b/test/documents/chunk_options_ref.md @@ -18,9 +18,9 @@ println(y) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ [2,5,12] -~~~~~~~~~~~~~ +~~~~ @@ -29,24 +29,24 @@ println(x) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ [12,10] -~~~~~~~~~~~~~ +~~~~ -~~~~{.julia} +~~~~ Results without code -~~~~~~~~~~~~~ +~~~~ -~~~~{.julia} +~~~~ [12,10] -~~~~~~~~~~~~~ +~~~~ @@ -68,9 +68,9 @@ println(y) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ 1:5 -~~~~~~~~~~~~~ +~~~~ @@ -102,14 +102,14 @@ println(collect(0:10:1000)) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ [0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,2 10,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390, 400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580 ,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77 0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,9 60,970,980,990,1000] -~~~~~~~~~~~~~ +~~~~ @@ -120,9 +120,9 @@ println(collect(0:10:1000)) ~~~~~~~~~~~~~ -~~~~{.julia}[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990,1000] +~~~~[0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600,610,620,630,640,650,660,670,680,690,700,710,720,730,740,750,760,770,780,790,800,810,820,830,840,850,860,870,880,890,900,910,920,930,940,950,960,970,980,990,1000] -~~~~~~~~~~~~~ +~~~~ @@ -133,7 +133,7 @@ println(collect(0:10:1000)) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ [0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,17 0,180,190,200,210,220,230,240,250,260,270,280,290,300,310,32 0,330,340,350,360,370,380,390,400,410,420,430,440,450,460,47 @@ -141,6 +141,6 @@ println(collect(0:10:1000)) 0,630,640,650,660,670,680,690,700,710,720,730,740,750,760,77 0,780,790,800,810,820,830,840,850,860,870,880,890,900,910,92 0,930,940,950,960,970,980,990,1000] -~~~~~~~~~~~~~ +~~~~ diff --git a/test/documents/gadfly_markdown_test_ref.md b/test/documents/gadfly_markdown_test_ref.md index a119a46..a967493 100644 --- a/test/documents/gadfly_markdown_test_ref.md +++ b/test/documents/gadfly_markdown_test_ref.md @@ -33,7 +33,7 @@ println(x) ```` -````julia +```` linspace(0.0,200.0,50) ```` @@ -73,7 +73,7 @@ println(x) ```` -````julia +```` linspace(0.0,200.0,50) ```` diff --git a/test/documents/pyplot_formats_ref. b/test/documents/pyplot_formats_ref. new file mode 100644 index 0000000..409a7d7 --- /dev/null +++ b/test/documents/pyplot_formats_ref. @@ -0,0 +1,74 @@ + + + + +````julia +using PyPlot +x = linspace(0, 2π, 200) +plot(x, sin(x)) +```` + + +```` +1-element Array{Any,1}: + PyObject +```` + + +![sin(x) function.](figures/pyplot_formats_sin_fun_1.png) + + + +```` +1-element Array{Any,1}: + PyObject +```` + + +![cos(x) function.](figures/pyplot_formats_2_1.png) + + + +```` +1-element Array{Any,1}: + PyObject +```` + + +![](figures/pyplot_formats_cos2_fun_1.png) + + + +````julia +julia> x = linspace(0, 2π, 200) + +linspace(0.0,6.283185307179586,200) +julia> plot(x, sin(x)) + +1-element Array{Any,1}: + PyObject +julia> y = 20 + +20 +julia> plot(x, cos(x)) +1-element Array{Any,1}: + PyObject +```` + + +![](figures/pyplot_formats_4_1.png) + + + +````julia +x = randn(100, 100) +contourf(x) +```` + + +```` +PyObject +```` + + +![](figures/pyplot_formats_5_1.png) diff --git a/test/documents/pyplot_formats_ref.md b/test/documents/pyplot_formats_ref.md index a6947a5..409a7d7 100644 --- a/test/documents/pyplot_formats_ref.md +++ b/test/documents/pyplot_formats_ref.md @@ -9,14 +9,32 @@ plot(x, sin(x)) ```` +```` +1-element Array{Any,1}: + PyObject +```` + + ![sin(x) function.](figures/pyplot_formats_sin_fun_1.png) +```` +1-element Array{Any,1}: + PyObject +```` + + ![cos(x) function.](figures/pyplot_formats_2_1.png) +```` +1-element Array{Any,1}: + PyObject +```` + + ![](figures/pyplot_formats_cos2_fun_1.png) @@ -28,13 +46,13 @@ linspace(0.0,6.283185307179586,200) julia> plot(x, sin(x)) 1-element Array{Any,1}: - PyObject + PyObject julia> y = 20 20 julia> plot(x, cos(x)) 1-element Array{Any,1}: - PyObject + PyObject ```` @@ -48,4 +66,9 @@ contourf(x) ```` +```` +PyObject +```` + + ![](figures/pyplot_formats_5_1.png) diff --git a/test/documents/pyplot_formats_ref.rst b/test/documents/pyplot_formats_ref.rst index 9448c87..5cf5b7c 100644 --- a/test/documents/pyplot_formats_ref.rst +++ b/test/documents/pyplot_formats_ref.rst @@ -10,6 +10,13 @@ +:: + + 1-element Array{Any,1}: + PyObject + + + .. figure:: figures/pyplot_formats_sin_fun_1.svg :width: 15 cm @@ -18,6 +25,13 @@ +:: + + 1-element Array{Any,1}: + PyObject + + + .. figure:: figures/pyplot_formats_2_1.svg :width: 15 cm @@ -26,6 +40,13 @@ +:: + + 1-element Array{Any,1}: + PyObject + + + .. image:: figures/pyplot_formats_cos2_fun_1.svg :width: 15 cm @@ -40,13 +61,13 @@ linspace(0.0,6.283185307179586,200) julia> plot(x, sin(x)) 1-element Array{Any,1}: - PyObject + PyObject julia> y = 20 20 julia> plot(x, cos(x)) 1-element Array{Any,1}: - PyObject + PyObject @@ -63,6 +84,12 @@ julia> plot(x, cos(x)) +:: + + PyObject + + + .. image:: figures/pyplot_formats_5_1.svg :width: 15cm diff --git a/test/documents/pyplot_formats_ref.tex b/test/documents/pyplot_formats_ref.tex index 5e70b5c..35dfc20 100644 --- a/test/documents/pyplot_formats_ref.tex +++ b/test/documents/pyplot_formats_ref.tex @@ -7,6 +7,10 @@ using PyPlot x = linspace(0, 2π, 200) plot(x, sin(x)) \end{juliacode} +\begin{juliaout} +1-element Array{Any,1}: + PyObject +\end{juliaout} \begin{figure}[ht] \center \includegraphics[width=\linewidth]{figures/pyplot_formats_sin_fun_1.pdf} @@ -16,6 +20,10 @@ plot(x, sin(x)) +\begin{juliaout} +1-element Array{Any,1}: + PyObject +\end{juliaout} \begin{figure}[htpb] \center \includegraphics[width=\linewidth]{figures/pyplot_formats_2_1.pdf} @@ -24,6 +32,10 @@ plot(x, sin(x)) +\begin{juliaout} +1-element Array{Any,1}: + PyObject +\end{juliaout} \includegraphics[width=\linewidth]{figures/pyplot_formats_cos2_fun_1.pdf} @@ -35,13 +47,13 @@ linspace(0.0,6.283185307179586,200) julia> plot(x, sin(x)) 1-element Array{Any,1}: - PyObject + PyObject julia> y = 20 20 julia> plot(x, cos(x)) 1-element Array{Any,1}: - PyObject + PyObject \end{juliaterm} \includegraphics[width=\linewidth]{figures/pyplot_formats_4_1.pdf} @@ -51,4 +63,7 @@ julia> plot(x, cos(x)) x = randn(100, 100) contourf(x) \end{juliacode} +\begin{juliaout} +PyObject +\end{juliaout} \includegraphics[width=15cm]{figures/pyplot_formats_5_1.pdf} diff --git a/test/documents/test_hold_ref.md b/test/documents/test_hold_ref.md index e04356e..3c14d47 100644 --- a/test/documents/test_hold_ref.md +++ b/test/documents/test_hold_ref.md @@ -18,9 +18,9 @@ print(x) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ 1:10 -~~~~~~~~~~~~~ +~~~~ @@ -38,9 +38,9 @@ display(x) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ 1:10 -~~~~~~~~~~~~~ +~~~~ @@ -94,10 +94,10 @@ display(x) ~~~~~~~~~~~~~ -~~~~{.julia} +~~~~ 1:10 1:10 -~~~~~~~~~~~~~ +~~~~ ![](figures/test_hold_3_1.png)\ diff --git a/test/documents/winston_formats_ref.md b/test/documents/winston_formats_ref.md index 57402a7..cbda6fb 100644 --- a/test/documents/winston_formats_ref.md +++ b/test/documents/winston_formats_ref.md @@ -7,6 +7,7 @@ julia> t = linspace(0, 2*pi, 100) linspace(0.0,6.283185307179587,100) julia> plot(t, sinc(t)) +Winston.FramedPlot(...) ```` @@ -17,6 +18,7 @@ julia> s = 1:10 1:10 julia> plot(s, "r*") +Winston.FramedPlot(...) ```` @@ -49,6 +51,11 @@ display(p) ```` +```` +warning: sub-optimal solution for plot +```` + + ![](figures/winston_formats_3_1.png) ````julia diff --git a/test/documents/winston_formats_ref.rst b/test/documents/winston_formats_ref.rst index 2ba4c27..e27aed3 100644 --- a/test/documents/winston_formats_ref.rst +++ b/test/documents/winston_formats_ref.rst @@ -8,6 +8,7 @@ julia> t = linspace(0, 2*pi, 100) linspace(0.0,6.283185307179587,100) julia> plot(t, sinc(t)) +Winston.FramedPlot(...) @@ -21,6 +22,7 @@ julia> s = 1:10 1:10 julia> plot(s, "r*") +Winston.FramedPlot(...) @@ -60,6 +62,12 @@ julia> plot(s, "r*") +:: + + warning: sub-optimal solution for plot + + + .. image:: figures/winston_formats_3_1.png :width: 15 cm diff --git a/test/documents/winston_formats_ref.tex b/test/documents/winston_formats_ref.tex index 44705a3..53c0162 100644 --- a/test/documents/winston_formats_ref.tex +++ b/test/documents/winston_formats_ref.tex @@ -7,16 +7,18 @@ julia> t = linspace(0, 2*pi, 100) linspace(0.0,6.283185307179587,100) julia> plot(t, sinc(t)) +Winston.FramedPlot(...) \end{juliaterm} -\includegraphics[width=\linewidth]{figures/winston_formats_1_1.pdf} +\includegraphics[width=\linewidth]{figures/winston_formats_1_1.png} \begin{juliaterm} julia> s = 1:10 1:10 julia> plot(s, "r*") +Winston.FramedPlot(...) \end{juliaterm} -\includegraphics[width=\linewidth]{figures/winston_formats_1_2.pdf} +\includegraphics[width=\linewidth]{figures/winston_formats_1_2.png} @@ -24,7 +26,7 @@ julia> plot(s, "r*") \begin{figure}[htpb] \center -\includegraphics[width=\linewidth]{figures/winston_formats_random_1.pdf} +\includegraphics[width=\linewidth]{figures/winston_formats_random_1.png} \caption{Random walk.} \label{fig:random} \end{figure} @@ -48,7 +50,10 @@ add(p, Curve(x, s, color="blue")) display(p) \end{juliacode} -\includegraphics[width=\linewidth]{figures/winston_formats_3_1.pdf} +\begin{juliaout} +warning: sub-optimal solution for plot +\end{juliaout} +\includegraphics[width=\linewidth]{figures/winston_formats_3_1.png} \begin{juliacode} @@ -77,4 +82,4 @@ l = Legend(.1, .9, {a,b,s}) add(p, s, a, b, l) display(p) \end{juliacode} -\includegraphics[width=\linewidth]{figures/winston_formats_3_2.pdf} +\includegraphics[width=\linewidth]{figures/winston_formats_3_2.png} diff --git a/test/documents/winston_formats_svg_ref.md b/test/documents/winston_formats_svg_ref.md index a1dd74a..bdaa4d7 100644 --- a/test/documents/winston_formats_svg_ref.md +++ b/test/documents/winston_formats_svg_ref.md @@ -7,10 +7,11 @@ julia> t = linspace(0, 2*pi, 100) linspace(0.0,6.283185307179587,100) julia> plot(t, sinc(t)) +Winston.FramedPlot(...) ~~~~~~~~~~~~~ -![](figures/winston_formats_1_1.svg)\ +![](figures/winston_formats_1_1.png)\ ~~~~{.julia} @@ -18,17 +19,18 @@ julia> s = 1:10 1:10 julia> plot(s, "r*") +Winston.FramedPlot(...) ~~~~~~~~~~~~~ -![](figures/winston_formats_1_2.svg)\ +![](figures/winston_formats_1_2.png)\ -![Random walk.](figures/winston_formats_random_1.svg) +![Random walk.](figures/winston_formats_random_1.png) @@ -51,7 +53,12 @@ display(p) ~~~~~~~~~~~~~ -![](figures/winston_formats_3_1.svg)\ +~~~~ +warning: sub-optimal solution for plot +~~~~ + + +![](figures/winston_formats_3_1.png)\ ~~~~{.julia} @@ -83,5 +90,5 @@ display(p) ~~~~~~~~~~~~~ -![](figures/winston_formats_3_2.svg)\ +![](figures/winston_formats_3_2.png)\