Commit 7ec287f0 authored by Damien.Morard's avatar Damien.Morard
Browse files

Add tp1

parent bb94aa93
.DS_Store
/.build
/Packages
/*.xcodeproj
{
"object": {
"pins": [
{
"package": "LogicKit",
"repositoryURL": "https://github.com/kyouko-taiga/LogicKit",
"state": {
"branch": "master",
"revision": "365ff8a876f2b354db648ed49c61448a695b53c1",
"version": null
}
}
]
},
"version": 1
}
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TP1",
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/kyouko-taiga/LogicKit", .branch("master")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "TP1",
dependencies: ["LogicKit"]),
.testTarget(
name: "TP1Tests",
dependencies: ["TP1"]),
]
)
# TP1
A description of this package.
import LogicKit
import LogicKitBuiltins
// Initial Term
// You can add other terms if needed
let de : Term = .var("de")
let vers : Term = .var("vers")
let batterie: Term = .var("batterie")
let reste : Term = .var("reste")
let pieces : Term = .var("pieces")
let head : Term = .var("head")
let tail : Term = .var("tail")
let x : Term = .var("x")
let y : Term = .var("y")
let z : Term = .var("z")
// KnowledgeBase is a collection which contains all the things we know
let kbMino: KnowledgeBase = [
// Complete the facts and rules in this knowledge base
// HERE
]
// We merge your knowledge base with builtins types in LogicKit
// Also, you can use all operation on Nat and List
let kb: KnowledgeBase = kbMino + KnowledgeBase(knowledge: (List.axioms + Nat.axioms))
// Write your examples to test your rules below !
import XCTest
import TP1Tests
var tests = [XCTestCaseEntry]()
tests += TP1Tests.__allTests()
XCTMain(tests)
import XCTest
import class Foundation.Bundle
final class TP1Tests: XCTestCase {
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
// Some of the APIs that we use below are available in macOS 10.13 and above.
guard #available(macOS 10.13, *) else {
return
}
let fooBinary = productsDirectory.appendingPathComponent("TP1")
let process = Process()
process.executableURL = fooBinary
let pipe = Pipe()
process.standardOutput = pipe
try process.run()
process.waitUntilExit()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let output = String(data: data, encoding: .utf8)
XCTAssertEqual(output, "Hello, world!\n")
}
/// Returns path to the built products directory.
var productsDirectory: URL {
#if os(macOS)
for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") {
return bundle.bundleURL.deletingLastPathComponent()
}
fatalError("couldn't find the products directory")
#else
return Bundle.main.bundleURL
#endif
}
static var allTests = [
("testExample", testExample),
]
}
import XCTest
extension TP1Tests {
static let __allTests = [
("testExample", testExample),
]
}
#if !os(macOS)
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(TP1Tests.__allTests),
]
}
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment