forked from Chareesa/DataStructures
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataSQLTest.js
More file actions
108 lines (91 loc) · 3.34 KB
/
dataSQLTest.js
File metadata and controls
108 lines (91 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'use strict';
//Public module
var expect = require('chai').expect;
//My modules
var stacktest = require('../lib/stackFunction.js');
var pezSifter = require('../lib/stackOfPez.js');
var arithmetic = require('../lib/stackArithmetic.js');
var LList = require('../lib/SLList.js');
var DLList = require('../lib/DLList.js');
var gradetest = require('../lib/gradingFunction.js');
var Deque = require('../lib/deque.js');
var isPalindrome = require('../lib/isPalindrome.js');
var EDMenu = require('../lib/priorityListMenu.js');
var Patient = require('../lib/newPatient.js');
//stack tests
describe('Unmatched Parenthesis', function() {
it('returns the index of the unmatched parenthesis', function() {
expect(stacktest('3 + 4) * 5')).to.eql([5]);
});
});
describe('No yellow pez', function() {
it('returns array without any yellow', function() {
expect(pezSifter(10)).to.not.include('Yellow');
});
});
describe('Infix to postfix', function() {
it('separates operators from operands', function() {
expect(arithmetic('4+3-8/7=0')).to.eql('07834=/-+');
});
});
//queue tests
describe('New Deque class', function() {
var testQue = new Deque();
testQue.enqueue('A');
testQue.enqueue('B');
testQue.push('C');
testQue.push('D');
testQue.dequeue();
testQue.pop();
it('adds and removes element from front and back', function() {
expect(testQue.dataStore).to.eql(['B', 'C']);
});
it('checks if the given word is a palindrome', function() {
expect(isPalindrome('moom')).to.be.true;
});
});
describe('Create menu for ED', function() {
var edMenu = new EDMenu();
edMenu.enterED('Oliver', 2);
edMenu.enterED('Stan', 1);
it('Calling enterED creates a new Patient and adds it to the dataStore', function() {
expect(edMenu.q.dataStore).to.contain(new Patient('Oliver', 2));
});
});
//llist tests
describe('Use ADVANCE function', function() {
var children = new LList();
children.insert('Joel', 'head');
children.insert('Charla', 'Joel');
children.insert('Chareesa', 'Charla');
children.insert('Justin', 'Chareesa');
children.insert('Bailey', 'Justin');
children.advancetoTail(2, 'Chareesa');
it('returns list of names after using advance function', function() {
expect(children.display()).to.eql('Joel, Charla, Justin, Bailey, Chareesa, ');
});
it('SHOW function returns the selected node\'s place in line', function() {
expect(children.show('Bailey')).to.eql('Bailey is number 4 in line.');
});
});
describe('Use BACK function', function() {
var rainbowColor = new DLList();
rainbowColor.insert('Red', 'head');
rainbowColor.insert('Orange', 'Red');
rainbowColor.insert('Yellow', 'Orange');
rainbowColor.insert('Green', 'Yellow');
rainbowColor.insert('Blue', 'Green');
rainbowColor.insert('Purple', 'Blue');
rainbowColor.backtoHead(3, 'Green');
it('returns list of names after using advance function', function() {
expect(rainbowColor.display()).to.eql('Red, Green, Orange, Yellow, Blue, Purple, ');
});
it('SHOW function returns the selected node\'s place in line', function() {
expect(rainbowColor.show('Yellow')).to.eql('Yellow is number 4 in line.');
});
});
describe('Run Grade Tracker', function() {
it('returns names matched with grades', function() {
expect(gradetest('Karl', 'A+', 'Stephanie', 'A+', 'Chareesa', 'A+')).to.eql('Karl:(A+) Stephanie:(A+) Chareesa:(A+) ');
});
});