~ubuntu-branches/ubuntu/trusty/gmetrics/trusty

« back to all changes in this revision

Viewing changes to src/test/groovy/org/gmetrics/metric/abc/result/AbcMetricResultTest.groovy

  • Committer: Package Import Robot
  • Author(s): Miguel Landaeta, Miguel Landaeta, tony mancill
  • Date: 2012-01-18 20:57:50 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120118205750-68fv86p7fs8xz470
Tags: 0.5-1
[Miguel Landaeta]
* New upstream release.
* Remove patch ftbfs_613266.diff since it was merged upstream.
* Update dates in copyright file.

[tony mancill]
* Set DMUA flag.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import org.gmetrics.metric.abc.AbcVector
21
21
import org.gmetrics.metric.abc.AbcTestUtil
22
22
import org.gmetrics.metric.Metric
 
23
import org.gmetrics.metric.MetricLevel
23
24
 
24
25
/**
25
26
 * Tests for AbcMetricResult
26
27
 *
27
28
 * @author Chris Mair
28
 
 * @version $Revision: 130 $ - $Date: 2010-07-21 22:46:24 -0400 (Wed, 21 Jul 2010) $
 
29
 * @version $Revision: 163 $ - $Date: 2011-10-02 21:55:46 -0400 (Sun, 02 Oct 2011) $
29
30
 */
30
31
class AbcMetricResultTest extends AbstractTestCase {
31
32
 
32
33
    private static final DEFAULT_FUNCTION_NAMES = ['total', 'average', 'minimum', 'maximum']
33
34
    private static final METRIC = new AbcMetric(functions:DEFAULT_FUNCTION_NAMES)
 
35
    private static final ABC_VECTOR = new AbcVector(0, 0, 0)
34
36
 
35
37
    void testPassingNullAbcVectorIntoConstructorThrowsException() {
36
 
        shouldFailWithMessageContaining('abcVector') { new AbcMetricResult(METRIC, null) }
 
38
        shouldFailWithMessageContaining('abcVector') { new AbcMetricResult(METRIC, MetricLevel.METHOD, null) }
 
39
    }
 
40
 
 
41
    void testPassingNullLevelIntoConstructorThrowsException() {
 
42
        shouldFailWithMessageContaining('metricLevel') { new AbcMetricResult(METRIC, null, ABC_VECTOR) }
37
43
    }
38
44
 
39
45
    void testGetLineNumberIsSameValuePassedIntoConstructor() {
40
 
        def abcVector = new AbcVector(0, 0, 0)
41
 
        def result = new AbcMetricResult(METRIC, abcVector, 67)
 
46
        def result = new AbcMetricResult(METRIC, MetricLevel.METHOD, ABC_VECTOR, 67)
42
47
        assert result.getLineNumber() == 67
43
48
    }
44
49
 
 
50
    void testGetMetricLevelIsSameValuePassedIntoConstructor() {
 
51
        def result = new AbcMetricResult(METRIC, MetricLevel.METHOD, ABC_VECTOR, 67)
 
52
        assert result.getMetricLevel() == MetricLevel.METHOD
 
53
    }
 
54
 
45
55
    void testValuesForEmptyVectorSetIsZero() {
46
56
        assert abcMetricResultAllFunctionValues(0, 0, 0) == 0
47
57
    }