-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed type for
Completions.Request.n
.
* Removed redundant `Equatable` conformance for `Identifier` * Renamed `Utils` to `JSON`, improved parsing * Added proper `Codeable` support for `Prompt`
- Loading branch information
1 parent
01b87b4
commit 1642db9
Showing
5 changed files
with
58 additions
and
6 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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import XCTest | ||
@testable import OpenAIGPT3 | ||
|
||
final class PromptTests: XCTestCase { | ||
|
||
func testEncodeStringToJSON() throws { | ||
let prompt: Prompt = .string("alpha") | ||
let json = try jsonEncode(prompt) | ||
XCTAssertEqual("\"alpha\"", json) | ||
} | ||
|
||
func testEncodeStringsToJSON() throws { | ||
let prompt: Prompt = .strings(["alpha","beta"]) | ||
let json = try jsonEncode(prompt) | ||
XCTAssertEqual("[\"alpha\",\"beta\"]", json) | ||
} | ||
|
||
func testDecodeStringFromJSON() throws { | ||
let result: Prompt = try jsonDecode("\"gamma\"") | ||
XCTAssertEqual(.string("gamma"), result) | ||
} | ||
|
||
func testDecodeStringsFromJSON() throws { | ||
let result: Prompt = try jsonDecode("[\"gamma\",\"delta\"]") | ||
XCTAssertEqual(.strings(["gamma", "delta"]), result) | ||
} | ||
|
||
} |