-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
174 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
var util = require('util'); | ||
|
||
var GroupElement = require('./lib/GroupElement.js'); | ||
|
||
function FieldElement(arg) { | ||
var self = this; | ||
|
||
GroupElement.call(self, arg); | ||
} | ||
|
||
FieldElement.prototype = {}; | ||
|
||
util.inherits(FieldElement, GroupElement); | ||
|
||
module.exports = FieldElement; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
function GroupElement(arg) { | ||
var self = this; | ||
|
||
var data = arg.data; | ||
this.getData = function () { return data; } | ||
|
||
} | ||
|
||
GroupElement.prototype = { | ||
clone: function () { | ||
var arg = {}; | ||
arg.data = this.getData(); | ||
return new GroupElement(arg); | ||
} | ||
}; | ||
|
||
module.exports = GroupElement; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
var assert = require('assert'); | ||
var algebra = require('../index.js'); | ||
|
||
var FieldElement = algebra.FieldElement; | ||
|
||
describe('FieldElement', function () { | ||
describe('constructor:', function () { | ||
it('', function() { | ||
}); | ||
}); | ||
|
||
describe('inheritance:', function () { | ||
it('is a GroupElement', function() { | ||
}); | ||
}); | ||
|
||
describe('mul()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
|
||
describe('inv()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
var assert = require('assert'); | ||
var algebra = require('../index.js'); | ||
|
||
var GroupElement = algebra.GroupElement; | ||
|
||
describe('GroupElement', function () { | ||
describe('constructor:', function () { | ||
it('requires data arg', function() { | ||
var a = new GroupElement({data:0}); | ||
assert.ok(a instanceof GroupElement); | ||
}); | ||
}); | ||
|
||
describe('clone()', function () { | ||
it('returns a copy of the object', function() { | ||
// TODO se riesco ad implementare clone a livello di GroupElement | ||
// potrei anche togliere i test dalle classi figlie? | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
|
||
describe('eq()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
|
||
describe('add()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
|
||
describe('sub()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
|
||
describe('neg()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
var assert = require('assert'); | ||
var algebra = require('../index.js'); | ||
|
||
var RingElement = algebra.RingElement; | ||
|
||
describe('RingElement', function () { | ||
describe('constructor:', function () { | ||
it('', function() { | ||
}); | ||
}); | ||
|
||
describe('inheritance:', function () { | ||
it('is a FieldElement', function() { | ||
}); | ||
}); | ||
|
||
describe('mul()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
|
||
describe('inv()', function () { | ||
it('is an abstract function', function() { | ||
}); | ||
}); | ||
}); | ||
|