45 
45 
function test_statistical_values_significant_figures_avarage() {

46 
46 

47 
47 
$stat_vals = $this>create_statistical_values(0.123457, 0.123456, 0.123456523847, 5);

48 

$this>assertEquals('0.123457–0.123456[5;x̄=0.1234565]', $this>html2text(statistical_values($stat_vals)));


48 
$this>assertEquals('0.123457–0.123456 [5;x̄=0.1234565]', $this>html2text(statistical_values($stat_vals)));

49 
49 

50 
50 
$stat_vals = $this>create_statistical_values(12.23, 14.2, 13.2231423, 15);

51 

$this>assertEquals('12.23–14.2[15;x̄=13.2]', $this>html2text(statistical_values($stat_vals)));


51 
$this>assertEquals('12.23–14.2 [15;x̄=13.2]', $this>html2text(statistical_values($stat_vals)));

52 
52 

53 
53 
$stat_vals = $this>create_statistical_values(4, 6, 5, 2);

54 

$this>assertEquals('4–6[2;x̄=5]', $this>html2text(statistical_values($stat_vals)));


54 
$this>assertEquals('4–6 [2;x̄=5]', $this>html2text(statistical_values($stat_vals)));

55 
55 

56 
56 
$stat_vals = $this>create_statistical_values(4, 6, 5.0000, 2);

57 

$this>assertEquals('4–6[2;x̄=5]', $this>html2text(statistical_values($stat_vals)));


57 
$this>assertEquals('4–6 [2;x̄=5]', $this>html2text(statistical_values($stat_vals)));

58 
58 

59 
59 
$stat_vals = $this>create_statistical_values(6.3467, 6.3482, 6.347034915, 20);

60 

$this>assertEquals('6.3467–6.3482[20;x̄=6.34703]', $this>html2text(statistical_values($stat_vals)));


60 
$this>assertEquals('6.3467–6.3482 [20;x̄=6.34703]', $this>html2text(statistical_values($stat_vals)));

61 
61 

62 
62 
$stat_vals = $this>create_statistical_values(0.00000001, 1, (1  0.00000001) / 2, 20);

63 

$this>assertEquals('1.0E8–1[20;x̄=0.5]', $this>html2text(statistical_values($stat_vals)));


63 
$this>assertEquals('1.0E8–1 [20;x̄=0.5]', $this>html2text(statistical_values($stat_vals)));

64 
64 

65 
65 
$stat_vals = $this>create_statistical_values(22, 23, 22.5, 4);

66 

$this>assertEquals('22–23[4;x̄=22.5]', $this>html2text(statistical_values($stat_vals)));


66 
$this>assertEquals('22–23 [4;x̄=22.5]', $this>html2text(statistical_values($stat_vals)));

67 
67 

68 
68 
// see https://dev.etaxonomy.eu/redmine/issues/8771#note17

69 
69 
$stat_vals = $this>create_statistical_values(22, 23, 22.047619, 24);

70 

$this>assertEquals('22–23[24;x̄=22]', $this>html2text(statistical_values($stat_vals)));


70 
$this>assertEquals('22–23 [24;x̄=22]', $this>html2text(statistical_values($stat_vals)));

71 
71 
}

72 
72 

73 
73 

74 
74 
function test_statistical_values_no_min_max() {

75 
75 

76 
76 
$stat_vals = $this>create_statistical_values(null, null, 0.1234, 5);

77 

$this>assertEquals('0.1234[5]', $this>html2text(statistical_values($stat_vals)));


77 
$this>assertEquals('0.1234 [5]', $this>html2text(statistical_values($stat_vals)));

78 
78 

79 
79 
// as discussed in https://dev.etaxonomy.eu/redmine/issues/8771#note16 variance etc should not be suppressed

80 
80 
$stat_vals = $this>create_statistical_values(null, null, 0.1234, 5, 0.3, 0.12);

81 

$this>assertEquals('0.1234[5;σ²=0.3;σ=0.12]', $this>html2text(statistical_values($stat_vals)));


81 
$this>assertEquals('0.1234 [5;σ²=0.3;σ=0.12]', $this>html2text(statistical_values($stat_vals)));


82 
}


83 


84 
function test_statistical_values_with_unit() {


85 


86 
$stat_vals = $this>create_statistical_values(2.2, 8.7, 5.234, 5, 0.3, 0.12);


87 
$this>assertEquals('2.2–8.7 [5;x̄=5;σ²=0.3;σ=0.12] cm', $this>html2text(statistical_values($stat_vals, 'cm')));

82 
88 
}

83 
89 

84 
90 
}

fix #8830 adding missing spaces to statistical value representations