---
title: Tests and Benchmark
---

# Tests

There exist several test suites for testing the correctness of a Markdown implementation. The
original [Markdown Test Suite] is the standard which one needs to test against. The [PHP Markdown
suite][MDTest] contains the original test suite and several more tests (some specifically geared
towards the extension of the PHP Markdown Extra package). I have used the latter test tool to
roughly verify that kramdown is able to parse standard Markdown. However, since the syntax used by
kramdown varies slightly from standard Markdown most of the tests fail - which is fine. When looking
at the differences one can see that the failures result from these differences.

Besides using the above mentioned test suite kramdown comes with its own set of tests which is used
to verify that the implementation matches the kramdown specification.

If you believe you have found a bug in the implementation, please follow these steps:

* Check the [syntax page](syntax.html) and see if the behaviour is not intended.

* If the behaviour is not intended and it seems that kramdown should parse some text in another
  fashion, please open a [bug report] and attach two files: one with the text and one with the HTML
  conversion you think is correct.

[bug report]: http://rubyforge.org/tracker/?atid=28673&group_id=7403&func=browse


# Benchmark

kramdown comes with a small benchmark to test how fast it is in regard to four other Ruby Markdown
implementations: Maruku, BlueFeather, BlueCloth and RDiscount. The first two are written using only
Ruby, the latter two use the C discount library for the actual hard work (which makes them really
fast but they do not provide additional syntax elements). As one can see below, kramdown is
currently (February 2012) ~3-4x faster than Maruku, ~4-5x faster than BlueFeather but ~30x slower
than BlueCloth and rdiscount:

<pre><code>
{execute_cmd: {command: "ruby -Ilib -rubygems benchmark/benchmark.rb", process_output: false, escape_html: true}}
</code>
</pre>

And here are some graphs which show the execution times of the various kramdown releases on
different Ruby interpreters:

![ruby 1.8.5p231]({relocatable: img/graph-ruby-1.8.5-231.png})
![ruby 1.8.6p399]({relocatable: img/graph-ruby-1.8.6-399.png})
![ruby 1.8.7p249]({relocatable: img/graph-ruby-1.8.7-249.png})
![ruby 1.8.7p302]({relocatable: img/graph-ruby-1.8.7-302.png})
![ruby 1.9.2p136]({relocatable: img/graph-ruby-1.9.2p136-136.png})
![ruby 1.9.3p125]({relocatable: img/graph-ruby-1.9.3p125-125.png})

[Markdown Test Suite]: http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip
[MDTest]: http://www.michelf.com/docs/projets/mdtest-1.0.zip
