Package jadx.tests.integration.loops

Source Code of jadx.tests.integration.loops.TestLoopCondition4$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 TestLoopCondition4 extends IntegrationTest {

  public static class TestCls {
    public static void test() {
      int n = -1;
      while (n < 0) {
        n += 12;
      }
      while (n > 11) {
        n -= 12;
      }
      System.out.println(n);
    }
  }

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

    assertThat(code, containsOne("int n = -1;"));
    assertThat(code, containsOne("while (n < 0) {"));
    assertThat(code, containsOne("n += 12;"));
    assertThat(code, containsOne("while (n > 11) {"));
    assertThat(code, containsOne("n -= 12;"));
    assertThat(code, containsOne("System.out.println(n);"));
  }
}
TOP

Related Classes of jadx.tests.integration.loops.TestLoopCondition4$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.