<?xml version="1.0" encoding="UTF-8"?>
<test-data
        xmlns="http://pmd.sourceforge.net/rule-tests"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">

    <test-code>
        <description>default: valid case</description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    void foo() {
        for (int i=0; i<42; i++) {
            foo();
        }
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>default: failing case</description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
    void foo() {
        for (int i=0, j=0; i<42; i++, j++) {
            foo();
        }
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>custom count: valid case</description>
        <rule-property name="maximumVariables">2</rule-property>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    void foo() {
        for (int i=0, j=0; i<42; i++, j++) {
            foo();
        }
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>custom count: valid (but useless) case</description>
        <rule-property name="maximumVariables">0</rule-property>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
    void foo() {
        for (;;) {
            foo();
        }
    }
}
        ]]></code>
    </test-code>

    <test-code>
        <description>custom count: failing case</description>
        <rule-property name="maximumVariables">2</rule-property>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
    void foo() {
        for (int i=0, j=0, k=0; i<42; i++, j++, k++) {
            foo();
        }
    }
}
        ]]></code>
    </test-code>
</test-data>
