-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
4 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
modules/glib/src/test/java/io/github/jwharm/javagi/test/glib/BitfieldTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* Java-GI - Java language bindings for GObject-Introspection-based libraries | ||
* Copyright (C) 2022-2023 Jan-Willem Harmannij | ||
* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library 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 | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.github.jwharm.javagi.test.glib; | ||
|
||
import org.gnome.glib.AsciiType; | ||
import org.gnome.glib.FileTest; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* Test bitfield compare operations. | ||
*/ | ||
public class BitfieldTest { | ||
|
||
@Test | ||
public void testBitfield() { | ||
FileTest mask = FileTest.IS_DIR.or(FileTest.IS_EXECUTABLE); | ||
|
||
assertTrue(mask.equals( | ||
FileTest.combined(FileTest.IS_DIR, FileTest.IS_EXECUTABLE))); | ||
assertTrue(mask.equals( | ||
FileTest.combined(FileTest.IS_DIR, FileTest.IS_EXECUTABLE) | ||
.getValue())); | ||
assertFalse(mask.equals(FileTest.IS_DIR)); | ||
assertFalse(mask.equals(AsciiType.DIGIT)); | ||
|
||
assertTrue(mask.test(FileTest.IS_DIR)); | ||
assertTrue(mask.test(FileTest.IS_EXECUTABLE.or(FileTest.IS_DIR))); | ||
assertFalse(mask.test(FileTest.EXISTS)); | ||
assertFalse(mask.test(AsciiType.ALPHA)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters