Skip to content

Commit

Permalink
update some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MacOMNI committed Jan 3, 2025
1 parent ce921e5 commit 78bb89f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
27 changes: 1 addition & 26 deletions Blockchain/Tests/BlockchainTests/GuaranteeingServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,6 @@ import Utils
@testable import Blockchain

struct GuaranteeingServiceTests {
func createSimpleBlob() -> Data {
let readOnlyLen: UInt32 = 256
let readWriteLen: UInt32 = 512
let heapPages: UInt16 = 4
let stackSize: UInt32 = 1024
let codeLength: UInt32 = 6

let readOnlyData = Data(repeating: 0x01, count: Int(readOnlyLen))
let readWriteData = Data(repeating: 0x02, count: Int(readWriteLen))
let codeData = Data([0, 0, 2, 1, 2, 0])

var blob = Data()
blob.append(contentsOf: withUnsafeBytes(of: readOnlyLen.bigEndian) { Array($0.dropFirst(1)) })
blob.append(contentsOf: withUnsafeBytes(of: readWriteLen.bigEndian) { Array($0.dropFirst(1)) })
blob.append(contentsOf: withUnsafeBytes(of: heapPages.bigEndian) { Array($0) })
blob.append(contentsOf: withUnsafeBytes(of: stackSize.bigEndian) { Array($0.dropFirst(1)) })
blob.append(readOnlyData)
blob.append(readWriteData)
blob.append(contentsOf: Array(codeLength.encode(method: .fixedWidth(4))))
blob.append(codeData)

return blob
}

func setup(
config: ProtocolConfigRef = .dev,
time: TimeInterval = 988,
Expand Down Expand Up @@ -69,13 +45,12 @@ struct GuaranteeingServiceTests {
let scheduler = services.scheduler

var allWorkPackages = [WorkPackageAndOutput]()
let blob = createSimpleBlob()
for _ in 0 ..< services.config.value.totalNumberOfCores {
let workpackage = WorkPackage(
authorizationToken: Data(),
authorizationServiceIndex: 0,
authorizationCodeHash: Data32.random(),
parameterizationBlob: blob,
parameterizationBlob: Data(),
context: RefinementContext.dummy(config: services.config),
workItems: try! ConfigLimitedSizeArray(config: services.config, defaultValue: WorkItem.dummy(config: services.config))
)
Expand Down
2 changes: 0 additions & 2 deletions PolkaVM/Tests/PolkaVMTests/StandardProgramTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@testable import Blockchain
import Foundation
import PolkaVM
import Testing
Expand Down Expand Up @@ -29,7 +28,6 @@ struct StandardProgramTests {
}

@Test func initialization() throws {
print("createBlob = \(createBlob().toHexString())")
_ = try StandardProgram(blob: createBlob(), argumentData: nil)
}
}

0 comments on commit 78bb89f

Please sign in to comment.