Skip to content

Commit

Permalink
adding jam test vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Jul 2, 2024
1 parent 2654e72 commit 8b36ad8
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "JAMTests/jamtestvectors"]
path = JAMTests/jamtestvectors
url = git@github.com:w3f/jamtestvectors.git
24 changes: 24 additions & 0 deletions JAMTests/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"originHash" : "02073a96e234cf0a04b67acb19f5feffa912570969455599cd8c7ff2f6333ca5",
"pins" : [
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax.git",
"state" : {
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
},
{
"identity" : "swift-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-testing.git",
"state" : {
"branch" : "main",
"revision" : "0e2d9cbb553aba8b9a8acf3d56d1bf042360855f"
}
}
],
"version" : 3
}
11 changes: 9 additions & 2 deletions JAMTests/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,29 @@ import PackageDescription

let package = Package(
name: "JAMTests",
platforms: [
.macOS(.v14),
],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "JAMTests",
targets: ["JAMTests"]
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-testing.git", branch: "main"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "JAMTests"
name: "JAMTests",
resources: [.copy("../../jamtestvectors")]
),
.testTarget(
name: "JAMTestsTests",
dependencies: ["JAMTests"]
dependencies: ["JAMTests", .product(name: "Testing", package: "swift-testing")]
),
],
swiftLanguageVersions: [.version("6")]
Expand Down
2 changes: 0 additions & 2 deletions JAMTests/Sources/JAMTests/JAMTests.swift

This file was deleted.

12 changes: 12 additions & 0 deletions JAMTests/Sources/JAMTests/TestLoader.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Foundation

enum TestLoader {
static func discover(forPath path: String) throws {
let prefix = Bundle.module.bundlePath + "/jamtestvectors/\(path)"
print("Discovering tests in \(prefix)")
let files = try FileManager.default.contentsOfDirectory(atPath: prefix)
var scaleFiles = files.filter { $0.hasSuffix(".scale") }
scaleFiles.sort()
print(scaleFiles)
}
}
13 changes: 0 additions & 13 deletions JAMTests/Tests/JAMTests/JAMTests.swift

This file was deleted.

10 changes: 10 additions & 0 deletions JAMTests/Tests/JAMTests/Safrole.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Testing

@testable import JAMTests

struct SafroleTests {
@Test func works() throws {
try TestLoader.discover(forPath: "safrole/tiny")
#expect(1 + 1 == 2)
}
}
1 change: 1 addition & 0 deletions JAMTests/jamtestvectors
Submodule jamtestvectors added at fa8699
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c80a60eaf06aa1bc3b9d48f7d3541282e34d308bcc613d98df75ba316c2ca443",
"originHash" : "56133d3e324bc0f87b394a4be85a53c4f93961add021330ea2354a21601638fd",
"pins" : [
{
"identity" : "async-channels",
Expand Down Expand Up @@ -64,6 +64,24 @@
"version" : "3.4.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax.git",
"state" : {
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
},
{
"identity" : "swift-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-testing.git",
"state" : {
"branch" : "main",
"revision" : "0e2d9cbb553aba8b9a8acf3d56d1bf042360855f"
}
},
{
"identity" : "tuples.swift",
"kind" : "remoteSourceControl",
Expand Down

0 comments on commit 8b36ad8

Please sign in to comment.