本文整理匯總了TypeScript中ava.AssertContext.is方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AssertContext.is方法的具體用法?TypeScript AssertContext.is怎麽用?TypeScript AssertContext.is使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ava.AssertContext
的用法示例。
在下文中一共展示了AssertContext.is方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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("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)
})
示例3: 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)
})
示例4: equalsBaseMacro
function equalsBaseMacro (
t: AssertContext,
id1: Identifier, id2: Identifier, expected: boolean): void {
const actual = id1.equalsBase(id2)
t.is(actual, expected)
}
示例5: compareBaseMacro
function compareBaseMacro (t: AssertContext,
idInterval1: IdentifierInterval, idInterval2: IdentifierInterval,
expected: IdentifierIteratorResults): void {
const actual: IdentifierIteratorResults =
compareBase(idInterval1, idInterval2)
t.is(actual, expected)
}
示例6: 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)
})
示例7: 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)
}