Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rolando Grave De Peralta Gonzalez
semantique_2019
Commits
ffa6bbde
Commit
ffa6bbde
authored
Mar 18, 2019
by
Damien.Morard
Browse files
Add session exercise 4
parent
4105a4c5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Exercices/Exercice4/Exercice4_semantique.pdf
0 → 100644
View file @
ffa6bbde
File added
Exercices/Exercice4/Package.resolved
0 → 100644
View file @
ffa6bbde
{
"object": {
"pins": [
{
"package": "LogicKit",
"repositoryURL": "https://github.com/kyouko-taiga/LogicKit",
"state": {
"branch": "master",
"revision": "8f2589cacf6a7a0d58cbabb9f178bc4909ca0ac4",
"version": null
}
}
]
},
"version": 1
}
Exercices/Exercice4/Package.swift
0 → 100644
View file @
ffa6bbde
// 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
:
"Exercice4"
,
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
:
"Exercice4"
,
dependencies
:
[
"LogicKit"
]),
.
testTarget
(
name
:
"Exercice4Tests"
,
dependencies
:
[
"Exercice4"
]),
]
)
Exercices/Exercice4/README.md
0 → 100644
View file @
ffa6bbde
# Exercice4
A description of this package.
Exercices/Exercice4/Sources/Exercice4/main.swift
0 → 100644
View file @
ffa6bbde
import
LogicKit
import
LogicKitBuiltins
let
x
:
Term
=
.
var
(
"
x
"
)
let
y
:
Term
=
.
var
(
"
y
"
)
let
z
:
Term
=
.
var
(
"
z
"
)
let
first
:
Term
=
.
var
(
"
first
"
)
let
last
:
Term
=
.
var
(
"
last
"
)
let
head
:
Term
=
.
var
(
"
head
"
)
let
tail
:
Term
=
.
var
(
"
tail
"
)
let
h1
:
Term
=
.
var
(
"
h1
"
)
let
t1
:
Term
=
.
var
(
"
t1
"
)
let
h2
:
Term
=
.
var
(
"
h2
"
)
let
t2
:
Term
=
.
var
(
"
t2
"
)
let
res
:
Term
=
.
var
(
"
res
"
)
var
kb
:
KnowledgeBase
=
[
// Complete the knowledge base !
// ...
]
kb
=
kb
+
KnowledgeBase
(
knowledge
:
(
Nat
.
axioms
+
List
.
axioms
))
// Write test below to test your rules !
//let req = kb.ask(.fact("op", x, ...))
//for binding in req{
// print(" Ma fact: ", binding["res"]!)
//}
Exercices/Exercice4/Tests/Exercice4Tests/Exercice4Tests.swift
0 → 100644
View file @
ffa6bbde
import
XCTest
import
class
Foundation
.
Bundle
final
class
Exercice4Tests
:
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
(
"Exercice4"
)
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
),
]
}
Exercices/Exercice4/Tests/Exercice4Tests/XCTestManifests.swift
0 → 100644
View file @
ffa6bbde
import
XCTest
#if !os(macOS)
public
func
allTests
()
->
[
XCTestCaseEntry
]
{
return
[
testCase
(
Exercice4Tests
.
allTests
),
]
}
#endif
\ No newline at end of file
Exercices/Exercice4/Tests/LinuxMain.swift
0 → 100644
View file @
ffa6bbde
import
XCTest
import
Exercice4Tests
var
tests
=
[
XCTestCaseEntry
]()
tests
+=
Exercice4Tests
.
allTests
()
XCTMain
(
tests
)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment