Compare commits
5 Commits
6809a95041
...
b70d452341
Author | SHA1 | Date | |
---|---|---|---|
|
b70d452341 | ||
|
eefd47a0fc | ||
|
f62c83ddbe | ||
|
76d1fb6c53 | ||
|
585fb2e9e8 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
*.bak
|
||||
*.bak
|
||||
.nyc_output
|
1
assignments/A2/.gitignore
vendored
Normal file
1
assignments/A2/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
A2temp.rkt
|
43
assignments/A2/A2.rkt
Normal file
43
assignments/A2/A2.rkt
Normal file
@ -0,0 +1,43 @@
|
||||
#lang racket
|
||||
|
||||
(require xml)
|
||||
(define (load-xexpr path)
|
||||
(xml->xexpr (document-element (read-xml (open-input-file path)))))
|
||||
|
||||
|
||||
(define (load-rubrics path)
|
||||
(define rubrics (load-xexpr path))
|
||||
(define (get-rubrics rubrics)
|
||||
(cond
|
||||
[(null? rubrics) '()]
|
||||
[(list? rubrics) (append (get-rubrics (car rubrics)) (get-rubrics (cdr rubrics)))]
|
||||
[else (list rubrics)]))
|
||||
(get-rubrics rubrics))
|
||||
|
||||
|
||||
; test for load-rubrics
|
||||
|
||||
(module+ test
|
||||
(require rackunit)
|
||||
(define rubrics (load-rubrics "rubrics.xml"))
|
||||
(check-equal? (length rubrics) 5)
|
||||
(for ([elt rubrics])
|
||||
(check-equal? (first elt) 'rubric)))
|
||||
|
||||
|
||||
|
||||
; test for assoc*
|
||||
|
||||
(module+ test
|
||||
(define test-list '(1 [keep 2] 3 [keep 4] [keep 5] 6))
|
||||
(check-equal? (assoc* 'keep test-list) 2)
|
||||
(check-equal? (assoc* 'discard test-list) #f))
|
||||
|
||||
(define (rubric-name rubric)
|
||||
(assoc* 'name (second rubric)))
|
||||
|
||||
(module+ test
|
||||
(check-equal?
|
||||
(sort (map rubric-name rubrics) string<=?)
|
||||
'("JavaScript Assignment" "Journal Entry" "Octave Assignment" "Python Assignment"
|
||||
"Racket assignment")))
|
9
assignments/A2/Explorer.rkt
Normal file
9
assignments/A2/Explorer.rkt
Normal file
@ -0,0 +1,9 @@
|
||||
#lang racket
|
||||
|
||||
(require xml)
|
||||
(define (load-xexpr path)
|
||||
(xml->xexpr (document-element (read-xml (open-input-file path)))))
|
||||
|
||||
(require explorer)
|
||||
(define data (load-xexpr "rubrics.xml"))
|
||||
(explore data)
|
1
assignments/A2/rubrics.xml
Normal file
1
assignments/A2/rubrics.xml
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
Title: Lab One
|
||||
Date: 2022-09-07T08:30:00
|
||||
Tags: cs2163, lab, frog, git
|
||||
Tags: cs2613, lab, frog, git
|
||||
In this lab we learned about how to use frog and git, and how to interact with the university git remote.
|
||||
<!-- more -->
|
||||
## Frog
|
||||
|
@ -1,6 +1,6 @@
|
||||
Title: Lab Two
|
||||
Date: 2022-09-12T08:30:00
|
||||
Tags: cs2163, lab, git, racket
|
||||
Tags: cs2613, lab, git, racket
|
||||
In this lab we learned more about git, and using racket to draw shapes
|
||||
<!-- more -->
|
||||
## Additional Git Information
|
||||
|
@ -1,6 +1,6 @@
|
||||
Title: Lab Three
|
||||
Date: 2022-09-14T08:30:00
|
||||
Tags: cs2163, lab, git, racket
|
||||
Tags: cs2613, lab, git, racket
|
||||
|
||||
In this lab I learned about Racket recursion techniques.
|
||||
<!-- more -->
|
||||
|
@ -1,6 +1,6 @@
|
||||
Title: Lab Eight
|
||||
Date: 2022-10-05T08:30:00
|
||||
Tags: cs2163, lab, javascript, type-coercion, functions, modules
|
||||
Tags: cs2613, lab, javascript, type-coercion, functions, modules
|
||||
|
||||
In this lab I learned the javascript basics
|
||||
<!-- more -->
|
||||
|
21
journal/_src/posts/2022-09-28-lab-nine.md
Normal file
21
journal/_src/posts/2022-09-28-lab-nine.md
Normal file
@ -0,0 +1,21 @@
|
||||
Title: Lab Nine
|
||||
Date: 2022-10-12T08:30:00
|
||||
Tags: cs2613, lab, javascript, tests, jasmine, nyc, test-coverage, debugging, objects, json
|
||||
|
||||
In this lab, I learned about how to use tests in javascript and how to view my test coverage
|
||||
<!-- more -->
|
||||
|
||||
## Testing in javascript with Jasmine
|
||||
With jasmine, tests are stored in *.spec.js files, and each "spec" is a way to give a test a name and designate it a purpose. Specs can be grouped in describe blocks that are often testing one function. Tests follow a syntax of passing in a function result into an `expect` function, which then tests it with the `toBe` function and if the results are the same the test passes.
|
||||
|
||||
## Viewing test coverage with nyc
|
||||
With nyc you can view the test coverage of a jasmine test suite, and it will show you what percent of functions, and lines are uncovered, as well as which lines are not covered with a test.
|
||||
|
||||
## Debugging javascript
|
||||
You can debug a javascript file with the `node inspect "filename.js"` command, and you can then inspect it from the command line or use an interactive debugger in a chrome based browser.
|
||||
|
||||
## Objects in javascript
|
||||
Objects in javascript are similar to mutable hash tables, and you can see this as an object function is just the "key" to a function inside the object.
|
||||
|
||||
## Json parsing
|
||||
In javascript you can parse a json file and parse it directly into an object. You can then perform any actions on this object. Assuming you are aware of what the object should contain you can then perform objects actually fitting of the object (like searching for a name in a json array of people).
|
@ -1,6 +1,6 @@
|
||||
Title: Lab Seven
|
||||
Date: 2022-10-03T08:30:00
|
||||
Tags: cs2163, lab, racket, macros
|
||||
Tags: cs2613, lab, racket, macros
|
||||
|
||||
In this lab I learned about macros
|
||||
<!-- more -->
|
||||
|
@ -1,6 +1,6 @@
|
||||
Title: Lab Six
|
||||
Date: 2022-09-28T08:30:00
|
||||
Tags: cs2163, lab, racket, hash-table, json
|
||||
Tags: cs2613, lab, racket, hash-table, json
|
||||
|
||||
In this lab I learned about using hash sets and json parsing in racket.
|
||||
<!-- more -->
|
||||
|
@ -6,7 +6,7 @@
|
||||
<title>CS2163 Blog</title>
|
||||
<meta name="description" content="CS2163 Blog">
|
||||
<meta name="author" content="Isaac Shoebottom">
|
||||
<meta name="keywords" content="recursion, lab, cs2613, git, frog, all, pattern-matching, scribble, cs2163, racket">
|
||||
<meta name="keywords" content="json, recursion, objects, hash-table, tests, javascript, frog, pattern-matching, scribble, racket, cs2163, jasmine, macros, cs2613, lab, git, modules, all, functions, nyc, test-coverage, type-coercion, debugging">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<link rel="canonical" href="http://www.example.com/index.html">
|
||||
@ -57,7 +57,7 @@
|
||||
</a>
|
||||
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="/tags\cs2163.html">cs2163</a><a class="dropdown-item" href="/tags\cs2613.html">cs2613</a><a class="dropdown-item" href="/tags\frog.html">frog</a><a class="dropdown-item" href="/tags\git.html">git</a><a class="dropdown-item" href="/tags\lab.html">lab</a><a class="dropdown-item" href="/tags\pattern-matching.html">pattern-matching</a><a class="dropdown-item" href="/tags\racket.html">racket</a><a class="dropdown-item" href="/tags\recursion.html">recursion</a><a class="dropdown-item" href="/tags\scribble.html">scribble</a>
|
||||
<a class="dropdown-item" href="/tags\cs2163.html">cs2163</a><a class="dropdown-item" href="/tags\cs2613.html">cs2613</a><a class="dropdown-item" href="/tags\debugging.html">debugging</a><a class="dropdown-item" href="/tags\frog.html">frog</a><a class="dropdown-item" href="/tags\functions.html">functions</a><a class="dropdown-item" href="/tags\git.html">git</a><a class="dropdown-item" href="/tags\hash-table.html">hash-table</a><a class="dropdown-item" href="/tags\jasmine.html">jasmine</a><a class="dropdown-item" href="/tags\javascript.html">javascript</a><a class="dropdown-item" href="/tags\json.html">json</a><a class="dropdown-item" href="/tags\lab.html">lab</a><a class="dropdown-item" href="/tags\macros.html">macros</a><a class="dropdown-item" href="/tags\modules.html">modules</a><a class="dropdown-item" href="/tags\nyc.html">nyc</a><a class="dropdown-item" href="/tags\objects.html">objects</a><a class="dropdown-item" href="/tags\pattern-matching.html">pattern-matching</a><a class="dropdown-item" href="/tags\racket.html">racket</a><a class="dropdown-item" href="/tags\recursion.html">recursion</a><a class="dropdown-item" href="/tags\scribble.html">scribble</a><a class="dropdown-item" href="/tags\test-coverage.html">test-coverage</a><a class="dropdown-item" href="/tags\tests.html">tests</a><a class="dropdown-item" href="/tags\type-coercion.html">type-coercion</a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@ -90,6 +90,58 @@
|
||||
|
||||
|
||||
<article>
|
||||
<header>
|
||||
<h2><a href='/2022\10\lab-nine.html'>Lab Nine</a></h2>
|
||||
<p class='date-and-tags'>
|
||||
<time datetime="2022-10-12" pubdate="true">2022-10-12</time> - <span class="tags"><a href="/tags\cs2163.html">cs2163</a>, <a href="/tags\lab.html">lab</a>, <a href="/tags\javascript.html">javascript</a>, <a href="/tags\tests.html">tests</a>, <a href="/tags\jasmine.html">jasmine</a>, <a href="/tags\nyc.html">nyc</a>, <a href="/tags\test-coverage.html">test-coverage</a>, <a href="/tags\debugging.html">debugging</a>, <a href="/tags\objects.html">objects</a>, <a href="/tags\json.html">json</a></span></p>
|
||||
<p class='authors'>By: <span class="authors">Isaac Shoebottom</span></p>
|
||||
</header>
|
||||
|
||||
<p>In this lab, I learned about how to use tests in javascript and how to view my test coverage</p>
|
||||
<footer>
|
||||
<a href='/2022\10\lab-nine.html'>… more …</a>
|
||||
</footer>
|
||||
</article>
|
||||
<article>
|
||||
<header>
|
||||
<h2><a href='/2022\10\lab-eight.html'>Lab Eight</a></h2>
|
||||
<p class='date-and-tags'>
|
||||
<time datetime="2022-10-05" pubdate="true">2022-10-05</time> - <span class="tags"><a href="/tags\cs2163.html">cs2163</a>, <a href="/tags\lab.html">lab</a>, <a href="/tags\javascript.html">javascript</a>, <a href="/tags\type-coercion.html">type-coercion</a>, <a href="/tags\functions.html">functions</a>, <a href="/tags\modules.html">modules</a></span></p>
|
||||
<p class='authors'>By: <span class="authors">Isaac Shoebottom</span></p>
|
||||
</header>
|
||||
|
||||
<p>In this lab I learned the javascript basics</p>
|
||||
<footer>
|
||||
<a href='/2022\10\lab-eight.html'>… more …</a>
|
||||
</footer>
|
||||
</article>
|
||||
<article>
|
||||
<header>
|
||||
<h2><a href='/2022\10\lab-seven.html'>Lab Seven</a></h2>
|
||||
<p class='date-and-tags'>
|
||||
<time datetime="2022-10-03" pubdate="true">2022-10-03</time> - <span class="tags"><a href="/tags\cs2163.html">cs2163</a>, <a href="/tags\lab.html">lab</a>, <a href="/tags\racket.html">racket</a>, <a href="/tags\macros.html">macros</a></span></p>
|
||||
<p class='authors'>By: <span class="authors">Isaac Shoebottom</span></p>
|
||||
</header>
|
||||
|
||||
<p>In this lab I learned about macros</p>
|
||||
<footer>
|
||||
<a href='/2022\10\lab-seven.html'>… more …</a>
|
||||
</footer>
|
||||
</article>
|
||||
<article>
|
||||
<header>
|
||||
<h2><a href='/2022\09\lab-six.html'>Lab Six</a></h2>
|
||||
<p class='date-and-tags'>
|
||||
<time datetime="2022-09-28" pubdate="true">2022-09-28</time> - <span class="tags"><a href="/tags\cs2163.html">cs2163</a>, <a href="/tags\lab.html">lab</a>, <a href="/tags\racket.html">racket</a>, <a href="/tags\hash-table.html">hash-table</a>, <a href="/tags\json.html">json</a></span></p>
|
||||
<p class='authors'>By: <span class="authors">Isaac Shoebottom</span></p>
|
||||
</header>
|
||||
|
||||
<p>In this lab I learned about using hash sets and json parsing in racket.</p>
|
||||
<footer>
|
||||
<a href='/2022\09\lab-six.html'>… more …</a>
|
||||
</footer>
|
||||
</article>
|
||||
<article>
|
||||
<header>
|
||||
<h2><a href='/2022\09\lab-five.html'>Lab Five</a></h2>
|
||||
<p class='date-and-tags'>
|
||||
|
@ -1,7 +1,11 @@
|
||||
http://www.example.com/2022\09\lab-three.html
|
||||
http://www.example.com/2022\10\lab-eight.html
|
||||
http://www.example.com/2022\09\lab-two.html
|
||||
http://www.example.com/2022\09\lab-five.html
|
||||
http://www.example.com/2022\09\lab-four-scribble-demo.html
|
||||
http://www.example.com/2022\09\lab-four.html
|
||||
http://www.example.com/2022\09\lab-six.html
|
||||
http://www.example.com/2022\09\lab-one.html
|
||||
http://www.example.com/2022\10\lab-nine.html
|
||||
http://www.example.com/2022\09\lab-four-scribble-demo.html
|
||||
http://www.example.com/2022\09\lab-five.html
|
||||
http://www.example.com/2022\09\lab-four.html
|
||||
http://www.example.com/2022\10\lab-seven.html
|
||||
http://www.example.com/About.html
|
||||
|
12
labs/L09/ancestry.js
Normal file
12
labs/L09/ancestry.js
Normal file
@ -0,0 +1,12 @@
|
||||
let read_json_file = require("./read_json_file.js").read_json_file;
|
||||
|
||||
let data = null;
|
||||
|
||||
function by_name(name) {
|
||||
if (data === null)
|
||||
data = read_json_file("./ancestry.json");
|
||||
// simple linear scan
|
||||
result = data.find(person => person.name === name) // find the result of the first person with the name
|
||||
return (result === undefined) ? null : result; // if the result is undefined, return null, otherwise return the result (since tests expect null not undefined)
|
||||
}
|
||||
exports.by_name = by_name;
|
41
labs/L09/ancestry.json
Normal file
41
labs/L09/ancestry.json
Normal file
@ -0,0 +1,41 @@
|
||||
[
|
||||
{"name": "Carolus Haverbeke", "sex": "m", "born": 1832, "died": 1905, "father": "Carel Haverbeke", "mother": "Maria van Brussel"},
|
||||
{"name": "Emma de Milliano", "sex": "f", "born": 1876, "died": 1956, "father": "Petrus de Milliano", "mother": "Sophia van Damme"},
|
||||
{"name": "Maria de Rycke", "sex": "f", "born": 1683, "died": 1724, "father": "Frederik de Rycke", "mother": "Laurentia van Vlaenderen"},
|
||||
{"name": "Jan van Brussel", "sex": "m", "born": 1714, "died": 1748, "father": "Jacobus van Brussel", "mother": "Joanna van Rooten"},
|
||||
{"name": "Philibert Haverbeke", "sex": "m", "born": 1907, "died": 1997, "father": "Emile Haverbeke", "mother": "Emma de Milliano"},
|
||||
{"name": "Jan Frans van Brussel", "sex": "m", "born": 1761, "died": 1833, "father": "Jacobus Bernardus van Brussel", "mother":null},
|
||||
{"name": "Pauwels van Haverbeke", "sex": "m", "born": 1535, "died": 1582, "father": "N. van Haverbeke", "mother":null},
|
||||
{"name": "Clara Aernoudts", "sex": "f", "born": 1918, "died": 2012, "father": "Henry Aernoudts", "mother": "Sidonie Coene"},
|
||||
{"name": "Emile Haverbeke", "sex": "m", "born": 1877, "died": 1968, "father": "Carolus Haverbeke", "mother": "Maria Sturm"},
|
||||
{"name": "Lieven de Causmaecker", "sex": "m", "born": 1696, "died": 1724, "father": "Carel de Causmaecker", "mother": "Joanna Claes"},
|
||||
{"name": "Pieter Haverbeke", "sex": "m", "born": 1602, "died": 1642, "father": "Lieven van Haverbeke", "mother":null},
|
||||
{"name": "Livina Haverbeke", "sex": "f", "born": 1692, "died": 1743, "father": "Daniel Haverbeke", "mother": "Joanna de Pape"},
|
||||
{"name": "Pieter Bernard Haverbeke", "sex": "m", "born": 1695, "died": 1762, "father": "Willem Haverbeke", "mother": "Petronella Wauters"},
|
||||
{"name": "Lieven van Haverbeke", "sex": "m", "born": 1570, "died": 1636, "father": "Pauwels van Haverbeke", "mother": "Lievijne Jans"},
|
||||
{"name": "Joanna de Causmaecker", "sex": "f", "born": 1762, "died": 1807, "father": "Bernardus de Causmaecker", "mother":null},
|
||||
{"name": "Willem Haverbeke", "sex": "m", "born": 1668, "died": 1731, "father": "Lieven Haverbeke", "mother": "Elisabeth Hercke"},
|
||||
{"name": "Pieter Antone Haverbeke", "sex": "m", "born": 1753, "died": 1798, "father": "Jan Francies Haverbeke", "mother": "Petronella de Decker"},
|
||||
{"name": "Maria van Brussel", "sex": "f", "born": 1801, "died": 1834, "father": "Jan Frans van Brussel", "mother": "Joanna de Causmaecker"},
|
||||
{"name": "Angela Haverbeke", "sex": "f", "born": 1728, "died": 1734, "father": "Pieter Bernard Haverbeke", "mother": "Livina de Vrieze"},
|
||||
{"name": "Elisabeth Haverbeke", "sex": "f", "born": 1711, "died": 1754, "father": "Jan Haverbeke", "mother": "Maria de Rycke"},
|
||||
{"name": "Lievijne Jans", "sex": "f", "born": 1542, "died": 1582, "father":null, "mother":null},
|
||||
{"name": "Bernardus de Causmaecker", "sex": "m", "born": 1721, "died": 1789, "father": "Lieven de Causmaecker", "mother": "Livina Haverbeke"},
|
||||
{"name": "Jacoba Lammens", "sex": "f", "born": 1699, "died": 1740, "father": "Lieven Lammens", "mother": "Livina de Vrieze"},
|
||||
{"name": "Pieter de Decker", "sex": "m", "born": 1705, "died": 1780, "father": "Joos de Decker", "mother": "Petronella van de Steene"},
|
||||
{"name": "Joanna de Pape", "sex": "f", "born": 1654, "died": 1723, "father": "Vincent de Pape", "mother": "Petronella Wauters"},
|
||||
{"name": "Daniel Haverbeke", "sex": "m", "born": 1652, "died": 1723, "father": "Lieven Haverbeke", "mother": "Elisabeth Hercke"},
|
||||
{"name": "Lieven Haverbeke", "sex": "m", "born": 1631, "died": 1676, "father": "Pieter Haverbeke", "mother": "Anna van Hecke"},
|
||||
{"name": "Martina de Pape", "sex": "f", "born": 1666, "died": 1727, "father": "Vincent de Pape", "mother": "Petronella Wauters"},
|
||||
{"name": "Jan Francies Haverbeke", "sex": "m", "born": 1725, "died": 1779, "father": "Pieter Bernard Haverbeke", "mother": "Livina de Vrieze"},
|
||||
{"name": "Maria Haverbeke", "sex": "m", "born": 1905, "died": 1997, "father": "Emile Haverbeke", "mother": "Emma de Milliano"},
|
||||
{"name": "Petronella de Decker", "sex": "f", "born": 1731, "died": 1781, "father": "Pieter de Decker", "mother": "Livina Haverbeke"},
|
||||
{"name": "Livina Sierens", "sex": "f", "born": 1761, "died": 1826, "father": "Jan Sierens", "mother": "Maria van Waes"},
|
||||
{"name": "Laurentia Haverbeke", "sex": "f", "born": 1710, "died": 1786, "father": "Jan Haverbeke", "mother": "Maria de Rycke"},
|
||||
{"name": "Carel Haverbeke", "sex": "m", "born": 1796, "died": 1837, "father": "Pieter Antone Haverbeke", "mother": "Livina Sierens"},
|
||||
{"name": "Elisabeth Hercke", "sex": "f", "born": 1632, "died": 1674, "father": "Willem Hercke", "mother": "Margriet de Brabander"},
|
||||
{"name": "Jan Haverbeke", "sex": "m", "born": 1671, "died": 1731, "father": "Lieven Haverbeke", "mother": "Elisabeth Hercke"},
|
||||
{"name": "Anna van Hecke", "sex": "f", "born": 1607, "died": 1670, "father": "Paschasius van Hecke", "mother": "Martijntken Beelaert"},
|
||||
{"name": "Maria Sturm", "sex": "f", "born": 1835, "died": 1917, "father": "Charles Sturm", "mother": "Seraphina Spelier"},
|
||||
{"name": "Jacobus Bernardus van Brussel", "sex": "m", "born": 1736, "died": 1809, "father": "Jan van Brussel", "mother": "Elisabeth Haverbeke"}
|
||||
]
|
25
labs/L09/loop-arith.js
Normal file
25
labs/L09/loop-arith.js
Normal file
@ -0,0 +1,25 @@
|
||||
function plus(a,b) {
|
||||
for (let i=0; i < a; i++){
|
||||
b++;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
function mult(a,b) {
|
||||
sum=0;
|
||||
for(let i=0; i < a; i++) {
|
||||
sum = plus(sum, b)
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
function minus(a,b) {
|
||||
for (let i=0; i < b; i++){
|
||||
a--;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
exports.plus = plus;
|
||||
exports.mult = mult;
|
||||
exports.minus = minus;
|
3
labs/L09/minus.js
Normal file
3
labs/L09/minus.js
Normal file
@ -0,0 +1,3 @@
|
||||
let arith=require("./loop-arith.js");
|
||||
|
||||
console.log(arith.minus(10,0));
|
8
labs/L09/read_json_file.js
Normal file
8
labs/L09/read_json_file.js
Normal file
@ -0,0 +1,8 @@
|
||||
let fs = require('fs');
|
||||
|
||||
function read_json_file(filename) {
|
||||
let contents = fs.readFileSync(filename);
|
||||
|
||||
return JSON.parse(contents);
|
||||
}
|
||||
exports.read_json_file=read_json_file;
|
17
labs/L09/spec/ancestry.spec.js
Normal file
17
labs/L09/spec/ancestry.spec.js
Normal file
@ -0,0 +1,17 @@
|
||||
let by_name=require("../ancestry.js").by_name;
|
||||
describe("by_name", function() {
|
||||
it("not-present", function() {
|
||||
expect(by_name("ronald mcdonald")).toBe(null);
|
||||
expect(by_name("Captain Ahab")).toBe(null);
|
||||
});
|
||||
it("first", function () {
|
||||
expect(by_name("Carolus Haverbeke")).toEqual({"name": "Carolus Haverbeke", "sex": "m", "born": 1832, "died": 1905, "father": "Carel Haverbeke", "mother": "Maria van Brussel"});
|
||||
});
|
||||
it("last", function () {
|
||||
expect(by_name("Jacobus Bernardus van Brussel")).toEqual({"name": "Jacobus Bernardus van Brussel", "sex": "m", "born": 1736, "died": 1809, "father": "Jan van Brussel", "mother": "Elisabeth Haverbeke"});
|
||||
});
|
||||
it("middle", function () {
|
||||
expect(by_name("Joanna de Pape")).toEqual( {"name": "Joanna de Pape", "sex": "f", "born": 1654, "died": 1723, "father": "Vincent de Pape", "mother": "Petronella Wauters"});
|
||||
});
|
||||
|
||||
});
|
11
labs/L09/spec/builtins.spec.js
Normal file
11
labs/L09/spec/builtins.spec.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe("identity",
|
||||
function() {
|
||||
it("1 === 1", function() { expect(1).toBe(1); });
|
||||
it("null === null", function() { expect(null).toBe(null); })
|
||||
});
|
||||
|
||||
describe("arithmetic",
|
||||
function() {
|
||||
it("1 + 1 === 2", function() { expect(1 + 1).toBe(2); });
|
||||
it("6 * 7 === 42", function() { expect(6*7).toBe(42); });
|
||||
});
|
43
labs/L09/spec/loop-arith.spec.js
Normal file
43
labs/L09/spec/loop-arith.spec.js
Normal file
@ -0,0 +1,43 @@
|
||||
let arith=require ("../loop-arith.js");
|
||||
|
||||
describe("plus",
|
||||
function() {
|
||||
it("1 + 1 = 2",
|
||||
function() {
|
||||
expect(arith.plus(1, 1)).toBe(2);
|
||||
});
|
||||
it("0 + x = x",
|
||||
function() {
|
||||
expect(arith.plus(0, 1)).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("mult",
|
||||
function() {
|
||||
it("0 * 2 = 0",
|
||||
function() {
|
||||
expect(arith.mult(0, 2)).toBe(0);
|
||||
});
|
||||
|
||||
it("1 * 2 = 2",
|
||||
function() {
|
||||
expect(arith.mult(1,2)).toBe(2);
|
||||
});
|
||||
it("2 * 2 = 4",
|
||||
function() {
|
||||
expect(arith.mult(2, 2)).toBe(4);
|
||||
});
|
||||
});
|
||||
|
||||
describe("minus",
|
||||
function() {
|
||||
it("1 - 1 = 0",
|
||||
function() {
|
||||
expect(arith.minus(1, 1)).toBe(0);
|
||||
});
|
||||
|
||||
it("0 - x = -x",
|
||||
function() {
|
||||
expect(arith.minus(0, 1)).toBe(-1);
|
||||
});
|
||||
});
|
13
labs/L09/spec/support/jasmine.json
Normal file
13
labs/L09/spec/support/jasmine.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"spec_dir": "spec",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.?(m)js"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers/**/*.?(m)js"
|
||||
],
|
||||
"env": {
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user