本文整理匯總了TypeScript中long.fromInt函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript fromInt函數的具體用法?TypeScript fromInt怎麽用?TypeScript fromInt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了fromInt函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should correctly dispatch receiveMetrics with an unmatching nextRequest", function() {
let response = new protos.cockroach.ts.tspb.TimeSeriesQueryResponse({
results: [
{
datapoints: [],
},
],
});
let request = new protos.cockroach.ts.tspb.TimeSeriesQueryRequest({
start_nanos: Long.fromInt(0),
end_nanos: Long.fromInt(10),
queries: [
{
name: "test.metric.1",
},
],
});
state = reducer(state, metrics.receiveMetrics(componentID, request, response));
assert.isDefined(state.queries);
assert.isDefined(state.queries[componentID]);
assert.lengthOf(_.keys(state.queries), 1);
assert.equal(state.queries[componentID].data, null);
assert.equal(state.queries[componentID].request, null);
assert.isUndefined(state.queries[componentID].nextRequest);
assert.isUndefined(state.queries[componentID].error);
});
示例2: IsLeader
export function IsLeader(info: protos.cockroach.server.serverpb.RangeInfo$Properties) {
const localRep = GetLocalReplica(info);
if (_.isNil(localRep)) {
return false;
}
return Long.fromInt(localRep.replica_id).eq(FixLong(info.raft_state.lead));
}
示例3: FixLong
export function FixLong(value: Long | number): Long {
if (value as any === 0) {
return Long.fromInt(0);
}
return value as Long;
}
示例4: it
it("100500 ^ 100500 mod 14 == 8", () => {
expect(modularPow(Long.fromInt(100500), 100500, 14)).toEqual(8);
});
示例5:
const mapper: OperationMapper = OperationMapper.Instance;
let graph: Graph;
const SIMPLE_MODEL: tensorflow.IGraphDef = {
node: [
{
name: 'image_placeholder',
op: 'Placeholder',
attr: {
dtype: {
type: tensorflow.DataType.DT_FLOAT,
},
shape: {
shape: {
dim: [
{size: Long.fromInt(3)}, {size: Long.fromInt(3)},
{size: Long.fromInt(3)}, {size: Long.fromInt(1)}
]
}
}
}
},
{
name: 'Const',
op: 'Const',
attr: {
dtype: {type: tensorflow.DataType.DT_INT32},
value: {
tensor: {
dtype: tensorflow.DataType.DT_INT32,
tensorShape: {dim: [{size: 3}, {size: 3}, {size: 1}, {size: 1}]},