Yingdi Yu | c9843cf | 2014-08-04 17:52:19 -0700 | [diff] [blame] | 1 | Notes for NSL (NDN Signature Logger) developers |
| 2 | =============================================== |
| 3 | |
| 4 | Requirements |
| 5 | ------------ |
| 6 | |
| 7 | Include the following license boilerplate into all `.hpp` and `.cpp` files: |
| 8 | |
| 9 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 10 | /** |
| 11 | * Copyright (c) 2014, Regents of the University of California |
| 12 | * |
| 13 | * This file is part of NSL (NDN Signature Logger). |
| 14 | * See AUTHORS.md for complete list of NSL authors and contributors. |
| 15 | * |
| 16 | * NSL is free software: you can redistribute it and/or modify it under the terms |
| 17 | * of the GNU General Public License as published by the Free Software Foundation, |
| 18 | * either version 3 of the License, or (at your option) any later version. |
| 19 | * |
| 20 | * NSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 21 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 22 | * PURPOSE. See the GNU General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU General Public License along with |
| 25 | * NSL, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 26 | ////// [optional part] ////// |
| 27 | * |
| 28 | * \author Author's Name <email@domain> |
| 29 | * \author Other Author's Name <another.email@domain> |
| 30 | ////// [end of optional part] ////// |
| 31 | */ |
| 32 | |
| 33 | Recommendations |
| 34 | --------------- |
| 35 | |
| 36 | NSL code is subject to ndn-cxx [code style](http://named-data.net/doc/ndn-cxx/0.2.0/code-style.html). |
| 37 | |
| 38 | |
| 39 | Running unit-tests |
| 40 | ------------------ |
| 41 | |
| 42 | To run unit tests, NSL needs to be configured and build with unit test support: |
| 43 | |
| 44 | ./waf configure --with-tests |
| 45 | ./waf |
| 46 | |
| 47 | The simplest way to run tests, is just to run the compiled binary without any parameters: |
| 48 | |
| 49 | # Run tests |
| 50 | ./build/unit-tests |
| 51 | |
| 52 | However, [Boost.Test framework](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/) |
| 53 | is very flexible and allows a number of run-time customization of what tests should be run. |
| 54 | For example, it is possible to choose to run only a specific test suite, only a specific |
| 55 | test case within a suite, or specific test cases within specific test suites: |
| 56 | |
| 57 | # Run Basic test case from all core test suites |
| 58 | ./build/unit-tests -t */Basic |
| 59 | |
| 60 | By default, Boost.Test framework will produce verbose output only when a test case fails. |
| 61 | If it is desired to see verbose output (result of each test assertion), add `-l all` |
| 62 | option to `./build/unit-tests` command. To see test progress, you can use `-l test_suite` |
| 63 | or `-p` to show progress bar: |
| 64 | |
| 65 | # Show report all log messages including the passed test notification |
| 66 | ./build/unit-tests -l all |
| 67 | |
| 68 | # Show test suite messages |
| 69 | ./build/unit-tests -l test_suite |
| 70 | |
| 71 | # Show nothing |
| 72 | ./build/unit-tests -l nothing |
| 73 | |
| 74 | # Show progress bar |
| 75 | ./build/unit-tests -p |
| 76 | |
| 77 | There are many more command line options available, information about |
| 78 | which can be obtained either from the command line using `--help` |
| 79 | switch, or online on [Boost.Test library](http://www.boost.org/doc/libs/1_48_0/libs/test/doc/html/) |
| 80 | website. |