this repo has no description
at master 48 lines 2.0 kB view raw
1// Copyright 2024 CUE Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package jsonschema 16 17import ( 18 "testing" 19 20 "github.com/go-quicktest/qt" 21) 22 23func TestVFrom(t *testing.T) { 24 qt.Assert(t, qt.IsTrue(vfrom(VersionDraft4).contains(VersionDraft4))) 25 qt.Assert(t, qt.IsTrue(vfrom(VersionDraft4).contains(VersionDraft6))) 26 qt.Assert(t, qt.IsTrue(vfrom(VersionDraft4).contains(VersionDraft2020_12))) 27 qt.Assert(t, qt.IsFalse(vfrom(VersionDraft6).contains(VersionDraft4))) 28} 29 30func TestVTo(t *testing.T) { 31 qt.Assert(t, qt.IsTrue(vto(VersionDraft4).contains(VersionDraft4))) 32 qt.Assert(t, qt.IsFalse(vto(VersionDraft4).contains(VersionDraft6))) 33 qt.Assert(t, qt.IsTrue(vto(VersionDraft6).contains(VersionDraft4))) 34 qt.Assert(t, qt.IsFalse(vto(VersionDraft6).contains(VersionDraft7))) 35} 36 37func TestVBetween(t *testing.T) { 38 qt.Assert(t, qt.IsFalse(vbetween(VersionDraft6, VersionDraft2019_09).contains(VersionDraft4))) 39 qt.Assert(t, qt.IsTrue(vbetween(VersionDraft6, VersionDraft2019_09).contains(VersionDraft6))) 40 qt.Assert(t, qt.IsTrue(vbetween(VersionDraft6, VersionDraft2019_09).contains(VersionDraft2019_09))) 41 qt.Assert(t, qt.IsFalse(vbetween(VersionDraft6, VersionDraft2019_09).contains(VersionDraft2020_12))) 42} 43 44func TestVSet(t *testing.T) { 45 qt.Assert(t, qt.IsTrue(vset(VersionDraft6).contains(VersionDraft6))) 46 qt.Assert(t, qt.IsFalse(vset(VersionDraft6).contains(VersionDraft4))) 47 qt.Assert(t, qt.IsFalse(vset(VersionDraft6).contains(VersionDraft7))) 48}