blob: 08a74bb8c525cf27d4036edf3a46b078f473e7cc [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 (
"time"
"android.googlesource.com/platform/tools/gpu/framework/assert"
)
// An example of testing time durations
func ExampleTime() {
ctx := assert.Context(nil)
assert.With(ctx).ThatDuration(time.Second * 1).IsAtLeast(time.Second * 2)
assert.With(ctx).ThatDuration(time.Second * 3).IsAtMost(time.Second * 4)
assert.With(ctx).ThatDuration(time.Second * 6).IsAtLeast(time.Second * 5)
assert.With(ctx).ThatDuration(time.Second * 8).IsAtMost(time.Second * 7)
// Output:
// Error
// Got: 1s
// Was less than: 2s
// Error
// Got: 8s
// Was more than: 7s
}