<?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><![CDATA[
copy index into array
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
   for (int i=0;i<10;i++) {
       a[i] = i;
   }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
copy one array to another
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
   for (int i=0;i<10;i++) {
       a[i] = b[i];
   }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
copy via while loop
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
  int i = 0;
  while (i < 10) {
   a[i] = b[i];
   i++;
  }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
copy involving multiple arrays is ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
  for (int i=0;i<10;i++) {
   x[i] = b[i] + 1;
   y[i] = a[i] + 2;
  }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
copy involving method invocation on array element is ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
  for (int i=0;i<10;i++) {
   a[i] = b[i].size();
  }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
using an offset, still bad
     ]]></description>
        <expected-problems>1</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
  for (int i=0;i<10;i++) {
   b[i]=a[i+6];
  }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
nested arrays on LHS, ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
  for (int i=0;i<10;i++) {
   b[c[i]] = a[i];
  }
 }
}
     ]]></code>
    </test-code>
    <test-code>
        <description><![CDATA[
adding to array is ok
     ]]></description>
        <expected-problems>0</expected-problems>
        <code><![CDATA[
public class Foo {
 public void bar() {
   for (int i=0;i<10;i++) {
       a[i] += b[i];
   }
 }
}
     ]]></code>
    </test-code>
</test-data>
