1+ //===----------------------------------------------------------------------===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
6+ // Licensed under Apache License v2.0
7+ //
8+ // See LICENSE.txt for license information
9+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10+ //
11+ // SPDX-License-Identifier: Apache-2.0
12+ //
13+ //===----------------------------------------------------------------------===//
14+
15+ package com .example .swift ;
16+
17+ import com .example .swift .MySwiftLibrary ;
18+ import org .junit .jupiter .api .BeforeAll ;
19+ import org .junit .jupiter .api .Disabled ;
20+ import org .junit .jupiter .api .Test ;
21+
22+ import java .util .Arrays ;
23+ import java .util .concurrent .CountDownLatch ;
24+ import java .util .stream .Collectors ;
25+
26+ import static org .junit .jupiter .api .Assertions .*;
27+
28+ public class MySwiftLibraryTest {
29+ @ Test
30+ void call_helloWorld () {
31+ MySwiftLibrary .helloWorld ();
32+ }
33+
34+ @ Test
35+ void call_globalTakeInt () {
36+ MySwiftLibrary .globalTakeInt (12 );
37+ }
38+
39+ @ Test
40+ void call_globalMakeInt () {
41+ long i = MySwiftLibrary .globalMakeInt ();
42+ assertEquals (42 , i );
43+ }
44+
45+ @ Test
46+ void call_globalTakeIntInt () {
47+ MySwiftLibrary .globalTakeIntInt (1337 , 42 );
48+ }
49+
50+ @ Test
51+ void call_writeString_jextract () {
52+ var string = "Hello Swift!" ;
53+ long reply = MySwiftLibrary .globalWriteString (string );
54+
55+ assertEquals (string .length (), reply );
56+ }
57+ }
0 commit comments