1 package util 2 3 import com.google.common.truth.Truth.assertThat 4 import dagger.hilt.android.plugin.util.SimpleAGPVersion 5 import org.junit.Test 6 7 class SimpleAGPVersionTest { 8 9 @Test parsingnull10 fun parsing() { 11 assertThat(SimpleAGPVersion.parse("4.2")) 12 .isEqualTo(SimpleAGPVersion(4, 2)) 13 assertThat(SimpleAGPVersion.parse("4.2.1")) 14 .isEqualTo(SimpleAGPVersion(4, 2)) 15 assertThat(SimpleAGPVersion.parse("7.0.0-alpha01")) 16 .isEqualTo(SimpleAGPVersion(7, 0)) 17 } 18 19 @Test comparingnull20 fun comparing() { 21 assertThat(SimpleAGPVersion(4, 2)) 22 .isEqualTo(SimpleAGPVersion(4, 2)) 23 assertThat(SimpleAGPVersion(4, 2)) 24 .isGreaterThan(SimpleAGPVersion(3, 4)) 25 assertThat(SimpleAGPVersion(4, 2)) 26 .isLessThan(SimpleAGPVersion(7, 0)) 27 28 assertThat(SimpleAGPVersion.parse("4.2.1")) 29 .isEqualTo(SimpleAGPVersion.parse("4.2.2")) 30 assertThat(SimpleAGPVersion.parse("4.2.1")) 31 .isGreaterThan(SimpleAGPVersion.parse("3.4.1")) 32 assertThat(SimpleAGPVersion.parse("4.2.1")) 33 .isLessThan(SimpleAGPVersion.parse("7.0.1")) 34 35 assertThat(SimpleAGPVersion.parse("4.2.1")) 36 .isLessThan(SimpleAGPVersion.parse("7.0.0-alpha01")) 37 assertThat(SimpleAGPVersion.parse("7.0.0-alpha01")) 38 .isEqualTo(SimpleAGPVersion.parse("7.0.0-alpha02")) 39 } 40 } 41