on master help sign in
text/tests-and-benchmarks.markdown
63 lines 2.3 kB history raw
1Tests and benchmarks
2====================
4Prerequisites
5-------------
7To run the tests and benchmarks, you will need the test data, which
8you can clone from one of the following locations:
10* Mercurial master repository:
11 [bitbucket.org/bos/text-test-data](https://bitbucket.org/bos/text-test-data)
13* Git mirror repository:
14 [github.com/bos/text-test-data](https://github.com/bos/text-test-data)
16You should clone that repository into the `tests` subdirectory (your
17clone must be named `text-test-data` locally), then run `make -C
18tests/text-test-data` to uncompress the test files. Many tests and
19benchmarks will fail if the test files are missing.
21Functional tests
22----------------
24The functional tests are located in the `tests` subdirectory. An overview of
25what's in that directory:
27 Makefile Has targets for common tasks
28 Tests Source files of the testing code
29 scripts Various utility scripts
30 text-tests.cabal Cabal file that compiles all benchmarks
32The `text-tests.cabal` builds:
34- A copy of the text library, sharing the source code, but exposing all internal
35 modules, for testing purposes
36- The different test suites
38To compile, run all tests, and generate a coverage report, simply use `make`.
40Benchmarks
41----------
43The benchmarks are located in the `benchmarks` subdirectory. An overview of
44what's in that directory:
46 Makefile Has targets for common tasks
47 haskell Source files of the haskell benchmarks
48 python Python implementations of some benchmarks
49 ruby Ruby implementations of some benchmarks
50 text-benchmarks.cabal Cabal file which compiles all benchmarks
52To compile the benchmarks, navigate to the `benchmarks` subdirectory and run
53`cabal configure && cabal build`. Then, you can run the benchmarks using:
55 ./dist/build/text-benchmarks/text-benchmarks
57However, since there's quite a lot of benchmarks, you usually don't want to
58run them all. Instead, use the `-l` flag to get a list of benchmarks:
60 ./dist/build/text-benchmarks/text-benchmarks
62And run the ones you want to inspect. If you want to configure the benchmarks
63further, the exact parameters can be changed in `Benchmarks.hs`.