Last change
on this file since 172:c94a80f38d7f was
171:02f4d5d9bfd7,
checked in by Peter Kovacs <kpeter@…>, 16 years ago
|
Improve and redesign test programs + unify their output (ticket #25)
- Move graph related utilities form test_tools.h to graph_test.h.
- Move the contents of graph_utils_test.h to graph_utils_test.cc.
- Rename map_test.h -> graph_maps_test.h.
- Rename digraph_test.h -> graph_test.h.
- Many improvements in the following files:
- digraph_test.cc
- graph_test.cc
- graph_test.h
- graph_maps_test.h
- graph_utils_test.cc
- bfs_test.cc
- dfs_test.cc
- counter_test.cc
- Test programs print messages only if it really seems necessary.
- Remove \file commands form .cc test files.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[119] | 1 | /* -*- C++ -*- |
---|
| 2 | * |
---|
| 3 | * This file is a part of LEMON, a generic C++ optimization library |
---|
| 4 | * |
---|
| 5 | * Copyright (C) 2003-2008 |
---|
| 6 | * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
---|
| 7 | * (Egervary Research Group on Combinatorial Optimization, EGRES). |
---|
| 8 | * |
---|
| 9 | * Permission to use, modify and distribute this software is granted |
---|
| 10 | * provided that this copyright notice appears in all copies. For |
---|
| 11 | * precise terms see the accompanying LICENSE file. |
---|
| 12 | * |
---|
| 13 | * This software is provided "AS IS" with no warranty of any kind, |
---|
| 14 | * express or implied, and with no claim as to its suitability for any |
---|
| 15 | * purpose. |
---|
| 16 | * |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #include <lemon/time_measure.h> |
---|
| 20 | |
---|
| 21 | using namespace lemon; |
---|
| 22 | |
---|
| 23 | void f() |
---|
| 24 | { |
---|
| 25 | double d=0; |
---|
| 26 | for(int i=0;i<1000;i++) |
---|
| 27 | d+=0.1; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | void g() |
---|
| 31 | { |
---|
| 32 | static Timer T; |
---|
| 33 | |
---|
| 34 | for(int i=0;i<1000;i++) |
---|
| 35 | TimeStamp x(T); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | int main() |
---|
| 39 | { |
---|
| 40 | Timer T; |
---|
| 41 | unsigned int n; |
---|
| 42 | for(n=0;T.realTime()<1.0;n++) ; |
---|
| 43 | std::cout << T << " (" << n << " time queries)\n"; |
---|
| 44 | T.restart(); |
---|
| 45 | while(T.realTime()<2.0) ; |
---|
| 46 | std::cout << T << '\n'; |
---|
| 47 | TimeStamp full; |
---|
| 48 | TimeStamp t; |
---|
| 49 | t=runningTimeTest(f,1,&n,&full); |
---|
| 50 | std::cout << t << " (" << n << " tests)\n"; |
---|
| 51 | std::cout << "Total: " << full << "\n"; |
---|
| 52 | |
---|
| 53 | t=runningTimeTest(g,1,&n,&full); |
---|
| 54 | std::cout << t << " (" << n << " tests)\n"; |
---|
| 55 | std::cout << "Total: " << full << "\n"; |
---|
| 56 | |
---|
| 57 | return 0; |
---|
| 58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.