本文整理汇总了TypeScript中ava.AssertContext类的典型用法代码示例。如果您正苦于以下问题:TypeScript AssertContext类的具体用法?TypeScript AssertContext怎么用?TypeScript AssertContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AssertContext类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test("randomInt32-upper-bound-is-excluded", (t: AssertContext) => {
// WARNING: No deterministric test (no seeded radom function)
for (let i = 0; i < 100; i++) {
t.is(randomInt32(0, 1), 0)
t.is(randomInt32(-1, 0), -1)
}
})
示例2: test
test("generateWithSameBase", (t: AssertContext) => {
const expected = 5
const tuple1: IdentifierTuple = new IdentifierTuple(42, 7, 8, 26)
const tuple2: IdentifierTuple = IdentifierTuple.fromBase(tuple1, expected)
t.true(tuple1.equalsBase(tuple2))
t.is(tuple2.offset, expected)
})
示例3: test
test("two-noncontiguous-bases", (t: AssertContext) => {
const replicaNumber = 0
const clock = 1
const id1: Identifier = new Identifier([new IdentifierTuple(0, replicaNumber, clock - 1, 0)])
const id2: Identifier = new Identifier([new IdentifierTuple(42, 0, 0, 0)])
const newId: Identifier = createBetweenPosition(id1, id2, replicaNumber, clock)
t.is(id1.compareTo(newId), Ordering.Less)
t.is(newId.compareTo(id2), Ordering.Less)
})
示例4: test
test("union-prepend-append", (t: AssertContext) => {
const begin = 0
const end = 5
const idInterval = generateIdInterval(begin, end)
const aBegin = -5
const aEnd = 10
const unionInterval = idInterval.union(aBegin, aEnd)
const expectedBegin = aBegin
const expectedEnd = aEnd
t.is(unionInterval.begin, expectedBegin)
t.is(unionInterval.end, expectedEnd)
})
示例5: equalsBaseMacro
function equalsBaseMacro (
t: AssertContext,
id1: Identifier, id2: Identifier, expected: boolean): void {
const actual = id1.equalsBase(id2)
t.is(actual, expected)
}
示例6: equalsBaseMacro
/**
* Macro to check if equalsBase() returns the expected result
*/
function equalsBaseMacro (
t: AssertContext,
tuple: IdentifierTuple, other: IdentifierTuple,
expected: boolean): void {
const actual: boolean = tuple.equalsBase(other)
t.is(actual, expected)
}