|
1 | 1 | import XCTest
|
2 | 2 | @testable import FunctionCalling_FirebaseVertexAI
|
| 3 | +import FunctionCalling |
3 | 4 |
|
4 | 5 | final class FunctionCalling_FirebaseVertexAITests: XCTestCase {
|
5 |
| - func testExample() throws { |
6 |
| - // XCTest Documentation |
7 |
| - // https://developer.apple.com/documentation/xctest |
| 6 | + @FunctionCalling(service: .claude) |
| 7 | + struct FunctionContainer { |
| 8 | + /// Return current weather of location that passed by the argument |
| 9 | + /// - Parameter location: location that I want to know how the weather |
| 10 | + /// - Returns: string of weather |
| 11 | + @CallableFunction |
| 12 | + func getWeather(location: String) -> String { |
| 13 | + return "Sunny" |
| 14 | + } |
8 | 15 |
|
9 |
| - // Defining Test Cases and Test Methods |
10 |
| - // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods |
11 |
| - } |
| 16 | + @CallableFunction |
| 17 | + func getStock(args: String) -> Int { |
| 18 | + return 0 |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + func testConvertedResults() throws { |
| 23 | + guard let functions = FunctionContainer().firebaseVertexAITools.first?.functions else { |
| 24 | + XCTFail("Conainer should contain some functions") |
| 25 | + return |
| 26 | + } |
| 27 | + |
| 28 | + XCTAssertEqual(functions.count, 2) |
| 29 | + |
| 30 | + let getWeather = try XCTUnwrap(functions.first) |
| 31 | + XCTAssertEqual(getWeather.getName(), "getWeather") |
| 32 | + XCTAssertEqual(getWeather.getDescription(), "Return current weather of location that passed by the argument- Parameter location: location that I want to know how the weather- Returns: string of weather") |
| 33 | + |
| 34 | + let getStock = try XCTUnwrap(functions.last) |
| 35 | + XCTAssertEqual(getStock.getName(), "getStock") |
| 36 | + XCTAssertEqual(getStock.getDescription(), "") |
| 37 | + } |
12 | 38 | }
|
0 commit comments