Skip to content

Commit 3e3837c

Browse files
update jacoco
1 parent 84670c7 commit 3e3837c

File tree

7 files changed

+162
-53
lines changed

7 files changed

+162
-53
lines changed

app/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Build Properties
2-
#Tue Jun 06 10:38:09 EDT 2023
3-
version_build=11
2+
#Sun Jun 11 11:45:25 EDT 2023
3+
version_build=12
44
version_major=3
55
version_minor=0
66
version_patch=11

app/jacoco.gradle

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@
1919
apply plugin: "jacoco"
2020

2121
jacoco {
22-
toolVersion = "0.8.9"
22+
toolVersion = "0.8.10"
2323
}
2424

25-
// FIXME: Gradle 8 & Jacoco where is exec file
2625
def executionPath = 'outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec'
2726

2827
def fileFilter = [
29-
'**/R.class',
30-
'**/R$*.class',
31-
'**/BuildConfig.*',
32-
'**/databinding/*.*',
33-
'**/Manifest*.*',
34-
'**/*Test*.*',
35-
'android/**/*.*',
36-
'**/com/jjoe64/*'
28+
'**/R.class',
29+
'**/R$*.class',
30+
'**/BuildConfig.*',
31+
'**/databinding/*.*',
32+
'**/Manifest*.*',
33+
'**/*Test*.*',
34+
'android/**/*.*',
35+
'**/com/jjoe64/*',
36+
'**/com/vrem/wifianalyzer/settings/SharedPreferences*'
3737
]
3838

3939
def classJavaDir = "$project.buildDir/intermediates/javac/debug/classes"
@@ -65,6 +65,7 @@ task jacocoTestCoverageVerification(type: JacocoCoverageVerification, dependsOn:
6565
violationRules {
6666
failOnViolation = true
6767
rule {
68+
element = 'BUNDLE'
6869
limit {
6970
counter = 'INSTRUCTION'
7071
minimum = 0.96
@@ -90,5 +91,28 @@ task jacocoTestCoverageVerification(type: JacocoCoverageVerification, dependsOn:
9091
minimum = 0.99
9192
}
9293
}
94+
rule {
95+
element = 'CLASS'
96+
limit {
97+
counter = 'INSTRUCTION'
98+
minimum = 0.67
99+
}
100+
limit {
101+
counter = 'BRANCH'
102+
minimum = 0.50
103+
}
104+
limit {
105+
counter = 'COMPLEXITY'
106+
minimum = 0.33
107+
}
108+
limit {
109+
counter = 'LINE'
110+
minimum = 0.60
111+
}
112+
limit {
113+
counter = 'METHOD'
114+
minimum = 0.33
115+
}
116+
}
93117
}
94118
}

app/src/main/kotlin/com/vrem/wifianalyzer/settings/Data.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
*/
1818
package com.vrem.wifianalyzer.settings
1919

20-
class Data(val code: String, val name: String) : Comparable<Data> {
20+
data class Data(val code: String, val name: String) : Comparable<Data> {
2121

2222
override fun compareTo(other: Data): Int =
23-
compareBy<Data> { it.name }.thenBy { it.code }.compare(this, other)
23+
compareBy<Data> { it.name }.thenBy { it.code }.compare(this, other)
2424

2525
}

app/src/main/kotlin/com/vrem/wifianalyzer/settings/Repository.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener
2323
import androidx.preference.PreferenceManager
2424
import com.vrem.wifianalyzer.R
2525

26-
inline fun SharedPreferences.edit(func: SharedPreferences.Editor.() -> Unit) {
27-
val editor: SharedPreferences.Editor = edit()
28-
editor.func()
29-
editor.apply()
30-
}
31-
3226
class Repository(private val context: Context) {
3327

3428
fun initializeDefaultValues(): Unit = defaultValues(context, R.xml.settings, false)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2015 - 2023 VREM Software Development <[email protected]>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
18+
package com.vrem.wifianalyzer.settings
19+
20+
import android.content.SharedPreferences
21+
22+
inline fun SharedPreferences.edit(func: SharedPreferences.Editor.() -> Unit) {
23+
val editor: SharedPreferences.Editor = edit()
24+
editor.func()
25+
editor.apply()
26+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2015 - 2023 VREM Software Development <[email protected]>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
18+
19+
package com.vrem.wifianalyzer.settings
20+
21+
import org.junit.Test
22+
import kotlin.test.assertEquals
23+
24+
internal class DataTest {
25+
26+
@Test
27+
fun compareToWhenAreSame() {
28+
// setup
29+
val data1 = Data("name", "code")
30+
val data2 = Data("name", "code")
31+
// execute
32+
val actual = data1.compareTo(data2)
33+
// validate
34+
assertEquals(0, actual)
35+
}
36+
37+
@Test
38+
fun compareToWhenCodesAreDifferent() {
39+
// setup
40+
val data1 = Data("name", "code1")
41+
val data2 = Data("name", "code2")
42+
// execute
43+
val actual = data1.compareTo(data2)
44+
// validate
45+
assertEquals(-1, actual)
46+
}
47+
48+
@Test
49+
fun compareToWhenNamesAreDifferent() {
50+
// setup
51+
val data1 = Data("name1", "code")
52+
val data2 = Data("name2", "code")
53+
// execute
54+
val actual = data1.compareTo(data2)
55+
// validate
56+
assertEquals(-1, actual)
57+
}
58+
59+
}

0 commit comments

Comments
 (0)