Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest testing / readme update #45

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
# !Please Read!

In node 7.7 release the api for the debugger changed and we did not yet mangage to update the plugin accordingly
In order for this plugin to work use 7.6 version of node get it from [npm][npm]
If you don't want to configure nvm to work with the debugger or your affraid you could break your current setup,
just download the binary to your desktop.
```bash
~/Desktop/node-v7.6.0-darwin-x64/bin/node --debug-brk examples/qqq.js
Copy link

@si-mikey si-mikey Mar 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--debug-brk and --debug are deprecated might want to refactor

Suggested change
~/Desktop/node-v7.6.0-darwin-x64/bin/node --debug-brk examples/qqq.js
~/Desktop/node-v7.6.0-darwin-x64/bin/node --inspect-brk examples/qqq.js

```
You could put an alias into your zshrc/bashrc/fishrc
This alias works assuming you put the node file you downloaded from [npm][npm] onto your desktop
If you want to place it somewhere else update the path accordingly
```bash
alias node7.6="~/Desktopnode-v7.6.0-darwin-x64/bin/node --debug-brk"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alias node7.6="~/Desktopnode-v7.6.0-darwin-x64/bin/node --debug-brk"
alias node7.6="~/Desktopnode-v7.6.0-darwin-x64/bin/node --inspect-brk"

```
If this does not work for you please consider to open an issue , join our [slack][slack] chatroom or talk to us on twitter and ask your question there.
We are always happy to help.

# Test Coverage

| User | Platform | Status |
|---|---|---|
| Mac OS X 10.12.6 Node 7.6 Vim 8.0| [Anzumana](https://github.com/anzumana) | +
| Linux Node Node 6.2 Vim 8.0 |User | + |
| Linux Node Node 6.2 Neovim 0.2.2 |User | - |

# Contributors

| User | Code | Docs | Continuous Integration | Testing | Test Coverage |
| --- | --- | --- |
|[sidorales](https://github.com/sidorares)| ʘ‿ʘ |ʘ‿ʘ|
|[anzumana](https://github.com/anzumana)||ʘ‿ʘ|
|[baopham](https://github.com/baopham)||ʘ‿ʘ|
|[coderofsalvation](https://github.com/coderofsalvation)||ʘ‿ʘ|
|[gitter-badger](https://github.com/gitter-badger)||ʘ‿ʘ|
|[mynameiscoffey](https://github.com/mynameiscoffey)||ʘ‿ʘ|
|[adambiggs](https://github.com/adambiggs)||ʘ‿ʘ|
|[bitdeli-chef](https://github.com/bitdeli-chef)||ʘ‿ʘ|

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=sidorares&url=https://github.com/sidorares/node-vim-debugger&title=node-vim-debugger&language=&tags=github&category=software)

node-vim-debugger
Expand Down Expand Up @@ -160,3 +199,8 @@ Move up one stack frame.
- [ndb](https://github.com/smtlaissezfaire/ndb)
- [node-profiler](https://github.com/bnoordhuis/node-profiler)
- [v8.log processor](https://github.com/sidorares/node-tick)

[gitter]: https://badges.gitter.im/Join
[slack]: https://javascriptvimdebugger.slack.com/
[npm]: https://nodejs.org/dist/v7.6.0/
[testing_breakpoints]: docs/testing.md#SetBreakpoint
7 changes: 7 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@

- repl DSL https://github.com/sidorares/node-vim-debugger/issues/11
- user configured actions on startup/step/break

- when you are in -nb mode with vim and open another file and you press the keyboard combination for stack frame up
TypeError: Cannot read propert 'dc'of undefined

include
https://github.com/kentcdodds/all-contributors/blob/master/README.md
into the repo
Binary file added artwork/javascript-vim-debugger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added artwork/javascript-vim-debugger.sketch
Binary file not shown.
1 change: 1 addition & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This road map is in no way set in stone for now its just a collection of things that we stil want to do.
34 changes: 34 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Integrationtests

#### vim.keys.break

Add a breakpoint at current line and column.

#### vim.keys.continue

Resume program execution until the next breakpoint is encountered, or the program terminates.

#### vim.keys.down

Move down one stack frame.

#### vim.keys.in

Step inside the current statement's execution.

#### vim.keys.next

Step to the next statement.

#### vim.keys.out

Step out of the current statement.

#### vim.keys.up

Move up one stack frame.


# Unit Tests

# EndToEnd Test
296 changes: 296 additions & 0 deletions examples/knobelSolution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
var result=[];
var result2= [];
//---------------------------------------
// Data definition
//---------------------------------------
class Card {
constructor(left,right,top,bottom) {
this._left = left;
this._right = right;
this._top= top;
this._bottom = bottom;
}
get right(){
return this._right;
}
set right(value){
this._right = value;
}
get left(){
return this._left;
}
set left(value){
this._left = value;
}
get top(){
return this._top;
}
set top(value){
this._top = value;
}
get bottom(){
return this._bottom;
}
set bottom(value){
this._bottom = value;
}
}
Card.prototype.toString = function dogToString() {
var convert = function convert(number){
const blueFront = 11;
const blueBack = -11;
const purpleFront = 12;
const purpleBack = -12;
const grayFront = 15;
const grayBack = -15;
const redFront = 16;
const redBack = -16;
switch(number){
case blueFront :
return 'blueFront';
case blueBack:
return 'blueBack';
case purpleFront:
return 'purpleFront';
case purpleBack:
return 'purpleBack';
case grayFront:
return 'grayFront';
case grayBack:
return 'grayBack';
case redFront:
return 'redFront';
case redBack:
return 'redBack';
default:
return "error in element";
}
}
var result = '(' + this.left + ' ' + this.right + ' ' + this.top + ' ' + this.bottom + ')';
return result;
}
class Game {
constructor(cardsArray) {
this.cards=cardsArray;
}
}


//---------------------------------------
// Function Defintions
//---------------------------------------
/**
* Rotate the card clockwise (to the right )
* @param card
*
*/
function rotateCard(card,j){
//console.log('rotateCard');
//console.log(card);
var tmp = Object.assign({},card);

switch (j){
case 0:
return card;
case 1:
card.top = tmp.left;
card.right = tmp.top;
card.bottom = tmp.right;
card.left = tmp.bottom;
return card;
case 2:
card.right = tmp.left;
card.bottom = tmp.top;
card.left = tmp.right;
card.top = tmp.bottom;
return card;
case 3:
card.bottom = tmp.left;
card.left = tmp.top;
card.top = tmp.right;
card.right = tmp.bottom;
return card;
default:
return card;
}
}
//print each array permutation of the game array
/**
* returns an array that contains every permutation of our game array
* @param game array initial game array
* @return array containing every permuation of the game array
*
*/
function print(array, n){
if(array.length==1) {
//return n.push(array[0]);
//var tmp = n.slice();
//tmp.push(array[0]);
//result.push(tmp);
//return result.push(n.push(array[0]));
//var arr3 = n
//console.log(n);
//return result.push(n);
//var tmp = n.concat(array);
//result.push(tmp);
result.push(n.concat(array[0]));
//result.push(array[0]);
return ;

//return result.push(n + "," + array[0]+ "this");
//result.push(n);
//return result.push(n,array[0]);
//return result.push(array[0]);
}
for(var i = 0;i<array.length;i++){
var oldValue = [];
if(n!==undefined){
oldValue =oldValue.concat(n);
}
var tmp = array.slice();
var tmp2 = tmp.splice(i,1);
//oldValue.push(tmp.splice(i,1));
oldValue.push(tmp2[0]);
//console.log(tmp);
//console.log(oldValue);
print(tmp, oldValue);
}
}
/**
*
*
*/
function rotate(array,n){
if(array.length==1) {
//if(array[0]== undefined){
//return result2.push(n);
return console.log(n + "," + array[0]);
//}
//return result2.push(n.concat(array[0]));
}
for(var i = 0;i<array.length;i++){
for(var j =0;j<4;j++){
var oldValue = [];
if(n!==undefined){
oldValue.push(n);
}
var tmp = array.slice();
oldValue.push(rotateCard(tmp[i],j));
tmp.splice(i,1);
rotate(tmp, oldValue);
}
}
}
function fact(x){
if(x==1) { return 1;}
return x*fact(x-1);
}
/**
* Checks if the game was solved and all card are in the
* right places
* @param game
* @return bool
*
*/
function checkSolution(game){
console.log('===============');
//console.log(game);
console.time('checkSolution');
// check left column
if( (game[0].right+game[1].left != 0) || (game[0].bottom+game[3].top != 0) ) return false;
if( (game[3].right+game[4].left != 0) || (game[3].bottom+game[6].top != 0) ) return false;
if( (game[6].right+game[7].left != 0) ) return false;

// check middle column
if( (game[1].right+game[2].left != 0) || (game[1].bottom+game[4].top != 0) ) return false;
if( (game[4].right+game[5].left != 0) || (game[4].bottom+game[7].top != 0) ) return false;
if( (game[7].right+game[8].left != 0) ) return false;
// check right column
if( (game[2].bottom+game[5].top != 0) ) return false;
if( (game[5].bottom+game[8].top != 0) ) return false;
console.log('Solution correct');
console.log(game);
solved=true;
return true;
console.timeEnd('checkSolution');
}

function main(){
const blueFront = 11;
const blueBack = -11;
const purpleFront = 12;
const purpleBack = -12;
const grayFront = 15;
const grayBack = -15;
const redFront = 16;
const redBack = -16;
var soluion = [];
var solved = false;
console.log('Knobel Calculations');
console.log('x x x');
console.log('x x x');
console.log('x x x');
//console.log(game);

var card0= new Card(grayFront, blueBack, redBack, purpleFront);
var card1= new Card(purpleFront, blueBack, redFront, grayBack);
var card2 = new Card(purpleFront, purpleBack, grayFront, blueBack);

var card3 = new Card(blueFront, grayBack, purpleBack, redFront);
var card4 = new Card(purpleBack, redFront, blueBack, grayFront);
var card5 = new Card(purpleFront , grayBack, blueFront, redBack);

var card6 = new Card(blueBack, purpleFront, redFront, grayBack);
var card7 = new Card(purpleFront, redBack, grayFront, blueBack);
var card8 = new Card(redFront, redBack, blueFront, grayBack);

var rotateArray = [card0,card1,card2,card3,card4,card5,card6,card7,card8];
//var game = new Game(cardsArray);
//console.log(game);
//console.log(fact(4));
rotateArray= [card0,card1,card0];
//rotateArray= [1,2,3];
console.log('this is our array');
print(rotateArray);
console.log(result);
//console.log(card0);
var test = result[0];

//console.log(result[0]);
//console.log('lets roate our testarray');
//console.log(rotateArray);
//rotate(rotateArray);
//console.log(result2);
//for(var i = 0; i< result.length;i++){
//result2=[];
//console.log('starting to rotate array');
//rotate(result[i]);
//console.log('rotation done');
//for(var j =0; i<result2.length;j++){
//console.log(i +" of " +result.length +" " + i/result.length*100+ "% done");
//if(checkSolution(result[i])){
//console.log('found result');
//console.log(result[i]);
//}
//}
//}

//for(var j = 0 ; j < result2.length; j++){
//if(checkSolution(result2[j])){
//return result2[j];
//};
//console.log('false');
//}
//}
//console.log(result2);
//console.log(result2[0]);
//console.log('starting with our check for the entire array');
//console.log(result2[5]);
return
return 'no solution found';
}
//---------------------------------------
// Code Execution
//---------------------------------------

console.log(main());
Loading