Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
|
|
@ -0,0 +1,41 @@
|
|||
package gemini
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
func TestCleanGeminiCodexToolParametersPreservesCanonicalSchema(t *testing.T) {
|
||||
input := []byte(`{"type":"object","properties":{"value":{"type":"string"}},"additionalProperties":false}`)
|
||||
|
||||
output := cleanGeminiCodexToolParameters(gjson.ParseBytes(input))
|
||||
|
||||
if string(output) != string(input) {
|
||||
t.Fatalf("canonical schema changed:\n got: %s\nwant: %s", output, input)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetCodexToolChoiceFromGeminiToolConfigReusesAutoChoice(t *testing.T) {
|
||||
input := []byte(`{"tool_choice":"auto","input":[]}`)
|
||||
config := gjson.Parse(`{"mode":"AUTO"}`)
|
||||
|
||||
output := setCodexToolChoiceFromGeminiToolConfig(input, config)
|
||||
|
||||
if &output[0] != &input[0] {
|
||||
t.Fatal("AUTO tool choice caused a payload copy")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanGeminiCodexToolParametersNormalizesSchema(t *testing.T) {
|
||||
input := []byte(`{"type":"object","$schema":"draft","additionalProperties":true}`)
|
||||
|
||||
output := cleanGeminiCodexToolParameters(gjson.ParseBytes(input))
|
||||
|
||||
if gjson.GetBytes(output, "$schema").Exists() {
|
||||
t.Fatal("$schema should be removed")
|
||||
}
|
||||
if additionalProperties := gjson.GetBytes(output, "additionalProperties"); additionalProperties.Type != gjson.False {
|
||||
t.Fatalf("additionalProperties = %s, want false", additionalProperties.Raw)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue