-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>, | ||
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors. | ||
* | ||
* This file is part of Amaze File Manager. | ||
* | ||
* Amaze File Manager is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem | ||
|
||
import org.junit.Assert | ||
import org.junit.Test | ||
import java.util.EnumSet | ||
|
||
class SearchParameterTest { | ||
@Test | ||
fun testAnd() { | ||
Check warning on line 29 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt#L29
|
||
val expected = EnumSet.of(SearchParameter.ROOT, SearchParameter.REGEX_MATCHES) | ||
val actual = SearchParameter.ROOT and SearchParameter.REGEX_MATCHES | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testPlus() { | ||
Check warning on line 36 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParameterTest.kt#L36
|
||
val expected = EnumSet.of(SearchParameter.ROOT, SearchParameter.REGEX_MATCHES) | ||
val actual = SearchParameter.ROOT + SearchParameter.REGEX_MATCHES | ||
Assert.assertEquals(expected, actual) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright (C) 2014-2024 Arpit Khurana <[email protected]>, Vishal Nehra <[email protected]>, | ||
* Emmanuel Messulam<[email protected]>, Raymond Lai <airwave209gt at gmail.com> and Contributors. | ||
* | ||
* This file is part of Amaze File Manager. | ||
* | ||
* Amaze File Manager is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.amaze.filemanager.asynchronous.asynctasks.searchfilesystem | ||
|
||
import org.junit.Assert | ||
import org.junit.Test | ||
import java.util.EnumSet | ||
|
||
class SearchParametersTest { | ||
|
||
@Test | ||
fun testAdd() { | ||
Check warning on line 30 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L30
|
||
val expected = EnumSet.of(SearchParameter.SHOW_HIDDEN_FILES, SearchParameter.ROOT) | ||
val actual = SearchParameter.SHOW_HIDDEN_FILES and SearchParameter.ROOT | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testPlus() { | ||
Check warning on line 37 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L37
|
||
val expected = EnumSet.of(SearchParameter.REGEX, SearchParameter.ROOT) | ||
val actual = EnumSet.of(SearchParameter.REGEX) + SearchParameter.ROOT | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testSearchParametersFromBooleanWithNone() { | ||
Check warning on line 44 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L44
|
||
val expected = EnumSet.noneOf(SearchParameter::class.java) | ||
val actual = searchParametersFromBoolean() | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testSearchParametersFromBooleanWithOne() { | ||
Check warning on line 51 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L51
|
||
val expected = EnumSet.of(SearchParameter.ROOT) | ||
val actual = searchParametersFromBoolean(isRoot = true) | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testSearchParametersFromBooleanWithTwo() { | ||
Check warning on line 58 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L58
|
||
val expected = EnumSet.of(SearchParameter.ROOT, SearchParameter.SHOW_HIDDEN_FILES) | ||
val actual = searchParametersFromBoolean(isRoot = true, showHiddenFiles = true) | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testSearchParametersFromBooleanWithThree() { | ||
Check warning on line 65 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L65
|
||
val expected = EnumSet.of( | ||
SearchParameter.ROOT, | ||
SearchParameter.REGEX, | ||
SearchParameter.REGEX_MATCHES | ||
) | ||
val actual = searchParametersFromBoolean( | ||
isRoot = true, | ||
isRegexEnabled = true, | ||
isRegexMatchesEnabled = true | ||
) | ||
Assert.assertEquals(expected, actual) | ||
} | ||
|
||
@Test | ||
fun testSearchParametersFromBooleanWithFour() { | ||
Check warning on line 80 in app/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt Codacy Production / Codacy Static Code Analysisapp/src/test/java/com/amaze/filemanager/asynchronous/asynctasks/searchfilesystem/SearchParametersTest.kt#L80
|
||
val expected = EnumSet.of( | ||
SearchParameter.ROOT, | ||
SearchParameter.REGEX, | ||
SearchParameter.REGEX_MATCHES, | ||
SearchParameter.SHOW_HIDDEN_FILES | ||
) | ||
val actual = searchParametersFromBoolean( | ||
isRoot = true, | ||
isRegexEnabled = true, | ||
isRegexMatchesEnabled = true, | ||
showHiddenFiles = true | ||
) | ||
Assert.assertEquals(expected, actual) | ||
} | ||
} |