File: README.md

package info (click to toggle)
mapcode 2.5.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,156 kB
  • sloc: ansic: 57,196; cpp: 626; sh: 246; makefile: 7
file content (73 lines) | stat: -rw-r--r-- 2,134 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Unit Tests

To build the unit tests, execute:

    cd ../mapcodelib
    gcc -DDEBUG -O -c mapcoder.c
    cd ../test
    gcc -DDEBUG -O -DDEBUG unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o

To execute the tests, simply execute:

    ./unittest

## Using `valgrind`  to Detect Memory Leaks

Compile and run as follows to use `valgrind` (http://valgrind.org) to detect memory leaks:

    cd ../mapcodelib
    gcc -g -O0 -c mapcoder.c
    cd ../test
    gcc -g -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
    valgrind --leak-check=yes ./unittest 

## Using the Address Sanitizer (from CLang) to Detect Memory Errors

Or, add `-fsanitize=address` to run the address sanitizer:

    cd ../mapcodelib
    gcc -O -c mapcoder.c
    cd ../test
    gcc -O unittest.c -lm -lpthread -fsanitize=address -o unittest ../mapcodelib/mapcoder.o

And add the environment variable `ASAN_OPTIONS` to your shell:

    ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:
        detect_invalid_pointer_pairs=99999:detect_container_overflow=true:
        detect_odr_violation=2:check_initialization_order=true:strict_init_order=true

## Using `gprof` to Profile the Library

Compile and run as follows to use `gprof` to profile the library:

    cd ../mapcodelib
    gcc -g -O0 -c mapcoder.c -pg
    cd ../test
    gcc -g -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg

## Using `gcov` to Show Test Coverage

Compile and run as follows to use `gcov` to show test coverage for the libray:

    cd ../mapcodelib
    gcc -fprofile-arcs -ftest-coverage -O0 -c mapcoder.c 
    cd ../test
    gcc  -fprofile-arcs -ftest-coverage -O0 unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o -pg
    ./unittest
    cd ../mapcodelib
    gcov mapcoder.c
    cd ../test
    gcov unittest.c

The test coverage reports are the `*.gcov` text files.

## Using Microsoft Visual C++

If you use **Microsoft Visual C++**, you may need to add the following defines to your preprocessor
settings:

    NO_POSIX_THREADS
    _CRT_SECURE_NO_WARNINGS
    _CRT_NONSTDC_NO_DEPRECATE