blob: da61fd3a380aeb332daa993a791652e52a65b2a9 [file] [log] [blame]
// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package assert_test
import "android.googlesource.com/platform/tools/gpu/framework/assert"
// An example of testing integer values
func ExampleInteger() {
ctx := assert.Context(nil)
assert.With(ctx).ThatInteger(1).Equals(2)
assert.With(ctx).ThatInteger(1).NotEquals(2)
assert.With(ctx).ThatInteger(1).IsAtLeast(2)
assert.With(ctx).ThatInteger(3).IsAtMost(4)
assert.With(ctx).ThatInteger(6).IsAtLeast(5)
assert.With(ctx).ThatInteger(8).IsAtMost(7)
assert.With(ctx).ThatInteger(3).IsBetween(2, 4)
assert.With(ctx).ThatInteger(3).IsBetween(3, 4)
assert.With(ctx).ThatInteger(3).IsBetween(2, 3)
assert.With(ctx).ThatInteger(3).IsBetween(4, 5)
assert.With(ctx).ThatInteger(3).IsBetween(1, 2)
// Output:
// Error
// Got: 1
// Expected: 2
// Error
// Got: 1
// Was less than: 2
// Error
// Got: 8
// Was more than: 7
// Error
// Got: 3
// Was not between 4 and 5
// Error
// Got: 3
// Was not between 1 and 2
}