diff --git a/.idea/UnitTestingCI.iml b/.idea/UnitTestingCI.iml
new file mode 100644
index 0000000..24643cc
--- /dev/null
+++ b/.idea/UnitTestingCI.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..28a804d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..c97ea18
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..ff4fe04
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1538355406237
+
+
+ 1538355406237
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index d68ba28..f4f5d0b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "testingtesttest",
+ "name": "unit_testing_ci",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
diff --git a/package.json b/package.json
index 44adc62..c07d07e 100644
--- a/package.json
+++ b/package.json
@@ -17,5 +17,13 @@
"license": "MIT",
"devDependencies": {
"jest": "^22.1.4"
- }
-}
\ No newline at end of file
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/Open-Source-Studio-at-ITP/UnitTestingCI.git"
+ },
+ "bugs": {
+ "url": "https://github.com/jOpen-Source-Studio-at-ITP/UnitTestingCI/issues"
+ },
+ "homepage": "https://github.com/Open-Source-Studio-at-ITP/UnitTestingCI#readme"
+}
diff --git a/sketch.js b/sketch.js
index 97d3243..8f2dd1f 100644
--- a/sketch.js
+++ b/sketch.js
@@ -29,6 +29,43 @@ function anomalyCode(x) {
return '5' + x - x;
}
+var numArray = [];
+var arrayLen = 10;
+
+function setArray(arrayLen){
+ for(var i = 0; i < arrayLen; i++){
+ numArray[i] = randInt(0, 100);
+ }
+
+ return numArray;
+}
+
+function randInt(min, max){
+ return Math.round(Math.random(min, max));
+}
+
+function factorize(num){
+ var totalProduct = 1;
+
+ for(var i = 1; i < num + 1; i++){
+ totalProduct *= i;
+ }
+
+ return totalProduct
+}
+
+class Point3D{
+ constructor(x, y, z){
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+}
+
+function inDist(p1, p2, d){
+ return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y) + (p1.z - p2.z) * (p1.z - p2.z) < d * d;
+}
+
function nOfFibonacci(x) {
let n = parseInt(x, 10);
return (!n || n < 1) ? -1 : (n < 3 ? 1 : (nOfFibonacci(n-1) + nOfFibonacci(n-2)));
@@ -43,5 +80,10 @@ module.exports = {
sayHelloTo: sayHelloTo,
answer: answer,
anomalyCode: anomalyCode,
+ setArray: setArray,
+ randInt: randInt,
+ factorize: factorize,
+ Point3D: Point3D,
+ inDist: inDist,
nOfFibonacci: nOfFibonacci
}
diff --git a/sketch.test.js b/sketch.test.js
index 17ea9e9..5679501 100644
--- a/sketch.test.js
+++ b/sketch.test.js
@@ -1,3 +1,4 @@
+const { sum, sub, prod, digital_root, sum42, sayHelloTo, anomalyCode, setArray, randInt, factorize, Point3D, inDist } = require('./sketch');
const { sum, sub, prod, digital_root, sum42, sayHelloTo, anomalyCode, nOfFibonacci } = require('./sketch');
const fs = require("fs");
const path = require("path");
@@ -59,7 +60,7 @@ test('prod calculates 2 * 10 = 20', () => {
test('digital root of 265 should equal 4', () => {
expect(digital_root(265)).toBe(4);
-})
+});
test('Sum42 function exists', () => {
expect(sum42).toBeDefined();
@@ -71,31 +72,51 @@ test('Sum42 3 + 1 should be 46', () => {
test('Sub function exists', () => {
expect(sub).toBeDefined();
-})
+});
test('Sub 10 - 3 should be 7', () => {
expect(sub(10,3)).toBe(7);
-})
+});
test('anomalyCode function exists', () => {
expect(anomalyCode(1)).toBeDefined();
-})
+});
test('anomalyCode one should be 50', () => {
expect(anomalyCode(7)).toBe(50);
-})
+});
test('anomalyCode ten should be 500', () => {
expect(anomalyCode(78)).toBe(500);
-})
+});
test('anomalyCode hundred should be 5000', () => {
expect(anomalyCode(789)).toBe(5000);
-})
+});
test('anomalyCode thousand should be 50000', () => {
expect(anomalyCode(7891)).toBe(50000);
-})
+});
+
+test('randInt generates random Integer', () => {
+ expect(Number.isInteger(randInt(1, 5))).toBe(true);
+});
+
+test('array length should match number of elements actually created', () =>{
+ expect(setArray(5).length).toBe(5);
+});
+
+test('factorize 5! should be 120', () => {
+ expect(factorize(5)).toBe(120);
+});
+
+test('Point3D object exists', () => {
+ expect(Point3D).toBeDefined();
+});
+
+test('intDist point (0, 0, 0) and (1, 1, 1) are within distance of 2', () => {
+ expect(inDist(new Point3D(0, 0, 0), new Point3D(1, 1, 1), 2)).toBe(true);
+});
test('the 20th number of fibonacci should be 6765', () => {
expect(nOfFibonacci(20)).toBe(6765);