Package jadx.tests.integration.loops

Source Code of jadx.tests.integration.loops.TestLoopCondition3

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 TestLoopCondition3 extends IntegrationTest {

  public static class TestCls {

    public static void test(int a, int b, int c) {
      while (a < 12) {
        if (b + a < 9 && b < 8) {
          if (b >= 2 && a > -1 && b < 6) {
            System.out.println("OK");
            c = b + 1;
          }
          b = a;
        }
        c = b;
        b++;
        b = c;
        a++;
      }
    }
  }

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

    assertThat(code, containsOne("while (a < 12) {"));
    assertThat(code, containsOne("if (b + a < 9 && b < 8) {"));
    assertThat(code, containsOne("if (b >= 2 && a > -1 && b < 6) {"));
  }
}
TOP

Related Classes of jadx.tests.integration.loops.TestLoopCondition3

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.