File: test_Ruler.cpp

package info (click to toggle)
vite 1.2%2Bsvn1430-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 20,164 kB
  • ctags: 3,915
  • sloc: cpp: 26,903; makefile: 455; sh: 111; ansic: 67
file content (40 lines) | stat: -rw-r--r-- 1,433 bytes parent folder | download | duplicates (7)
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
#include <iostream>
typedef double Element_pos;
#include "../../src/render/Ruler.hpp"


void display_information(const Element_pos min, const Element_pos max){
  Element_pos graduation_diff, coeff_prefix;
  Element_pos min_common_part, min_variable_part;
  Element_pos max_common_part, max_variable_part;


  graduation_diff = Ruler::get_graduation_diff(min, max);
  coeff_prefix    = Ruler::get_coeff_for_common_prefix(min, max);
        
  min_common_part   = Ruler::get_common_part(min, coeff_prefix);
  min_variable_part = Ruler::get_variable_part(min, coeff_prefix, 2);

  max_common_part   = Ruler::get_common_part(max, coeff_prefix);
  max_variable_part = Ruler::get_variable_part(max, coeff_prefix, 2);
             
  std::cout << "Display result for min=" << min << " and max=" << max << "\n"
            << "Graduation difference=" << graduation_diff << "\n"
            << "Coefficient for common prefix=" << coeff_prefix << "\n"
            << "Minimum:\n\tCommon part=" << min_common_part << "\n"
            << "\tVariable part=" << min_variable_part << "\n"
            << "Maximum:\n\tCommon part=" << max_common_part << "\n"
            << "\tVariable part=" << max_variable_part << "\n" << std::endl;
}


int main(int argc, char** argv){
  Element_pos min, max;

  display_information(1.0, 2.0);
  display_information(0.0, 0.50);
  display_information(0.10, 0.104);
  display_information(0.9, 1.0);

  return 0;
}