本文整理匯總了TypeScript中ava.AssertContext.true方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AssertContext.true方法的具體用法?TypeScript AssertContext.true怎麽用?TypeScript AssertContext.true使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ava.AssertContext
的用法示例。
在下文中一共展示了AssertContext.true方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test("randomInt32-in-interval", (t: AssertContext) => {
// WARNING: No deterministric test (no seeded radom function)
for (let i = 0; i < 100; i++) {
const r = randomInt32(INT32_BOTTOM, INT32_TOP)
t.true(isInt32(r) && r !== INT32_TOP)
}
})
示例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-contiguous-bases", (t: AssertContext) => {
const replicaNumber = 0
const clock = 1
const tuple: IdentifierTuple = new IdentifierTuple(0, replicaNumber, clock - 1, 0)
const id1: Identifier = new Identifier([tuple])
const id2: Identifier = new Identifier([new IdentifierTuple(1, 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)
t.is(newId.length, id1.length + 1)
t.true(id1.isPrefix(newId))
})