Package jadx.tests.integration.loops

Source Code of jadx.tests.integration.loops.TestContinueInLoop$TestCls

package jadx.tests.integration.loops;

import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;

import org.junit.Test;

import static jadx.tests.api.utils.JadxMatchers.containsOne;
import static org.junit.Assert.assertThat;

public class TestContinueInLoop extends IntegrationTest {

  public static class TestCls {
    private int f;

    private void test(int[] a, int b) {
      for (int i = 0; i < a.length; i++) {
        int v = a[i];
        if (v < b) {
          a[i]++;
        } else if (v > b) {
          a[i]--;
        } else {
          continue;
        }
        if (i < b) {
          break;
        }
      }
      this.f++;
    }
  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    String code = cls.getCode().toString();

    assertThat(code, containsOne("for (int i = 0; i < a.length; i++) {"));
    assertThat(code, containsOne("if (i < b) {"));
    assertThat(code, containsOne("continue;"));
    assertThat(code, containsOne("break;"));
    assertThat(code, containsOne("this.f++;"));
  }
}
TOP

Related Classes of jadx.tests.integration.loops.TestContinueInLoop$TestCls

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.