on text-jsstring-8.4 help sign in
text/tests-and-benchmarks.markdown
68 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 can clone either repository into the `tests` subdirectory using
18 cd tests/
19 make text-test-data # to clone from mercurial, OR
20 make VCS=git text-test-data # to clone from git
22Many tests and benchmarks will fail if the test files are missing.
24Functional tests
25----------------
27The functional tests are located in the `tests` subdirectory. An overview of
28what's in that directory:
30 Makefile Has targets for common tasks
31 Tests Source files of the testing code
32 scripts Various utility scripts
33 text-tests.cabal Cabal file that compiles all benchmarks
35The `text-tests.cabal` builds:
37- A copy of the text library, sharing the source code, but exposing all internal
38 modules, for testing purposes
39- The different test suites
41To compile, run all tests, and generate a coverage report, simply use `make`.
43Benchmarks
44----------
46The benchmarks are located in the `benchmarks` subdirectory. An overview of
47what's in that directory:
49 Makefile Has targets for common tasks
50 haskell Source files of the haskell benchmarks
51 python Python implementations of some benchmarks
52 ruby Ruby implementations of some benchmarks
53 text-benchmarks.cabal Cabal file which compiles all benchmarks
55To compile the benchmarks, navigate to the `benchmarks` subdirectory and run
56`cabal configure && cabal build`. Then, you can run the benchmarks using:
58 ./dist/build/text-benchmarks/text-benchmarks
60Or if you have a recent enough `cabal`, you can build and run the
61benchmarks via
63 cabal new-run exe:text-benchmarks -- --help
65However, since there's quite a lot of benchmarks, you usually don't want to
66run them all. Instead, use the `-l` flag to get a list of benchmarks
67and run the ones you want to inspect. If you want to configure the benchmarks
68further, the exact parameters can be changed in `Benchmarks.hs`.