0.1.0 • Published 3 years ago

@lucasjetta/stacking-weight-restriction v0.1.0

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
3 years ago

Stacking Weight Restriction

This repository came to life due to a demand of the Blocks Generation Algorithm. Occasionally, this restriction algorithm became somewhat big and was demanded somewhere else. Creating this repository was a natural evolution.

This repository implements the restriction of the allowed weight of a stack on an item. Said in another words: an item cannot have too much weight on it, otherwise it is damaged. The algorithm here implemented checks whether that situation occurs or not.

npm.io

Install Dependencies

This project is implemented using Node.js . npm is used for managing dependencies and meta data.

You can install all dependencies executing:

npm install .

Usage

This project is intended to be used by the Blocks Generation Algorithm. It implements an object with a check method:

module.exports = {
    block_stacking_restriction : function(){},
}

module.exports.block_stacking_restriction.prototype.check = function(block, container, input_struct) {
    // implementation details
}

Therefore, in order to use it, you add to your JavaScript code something like:

block_stacking_restriction = require("block_stacking_restriction");

restriction = new block_stacking_restriction.block_stacking_restriction();
restriction.check(block, container, input_struct);

Testing

For testing, the Mocha Framework is used in combination with Chai Assertion Library.

The tests are located in the folder src/test/. The data used in the tests are JSON files located in the folder src/test/data/.

You can run all the tests executing:

npm test

Code Coverage

This repository tries to keep tested all the developed code. You can check test coverage executing:

npm run coverage

Two reports will be created (see the figures below).

  1. coverage/index.html. Open it with any internet browser (firefox, chrome, ...) and check a detailed description of the code coverage.
  2. A summary report will be displayed on the command line.

Getting Help

This project was mainly developed by Lucas Guesser lucas@jettacargo.com.br, who you can contact in case you need any help.

Acknowledgment

Special thanks to Luiz luiz@jettacargo.com.br, Jean jean@jettacargo.com.br, and Caroline caroline@jettacargo.com.br who contributed very much with discussions and insights for the development and implementation of the algorithm.

0.1.0

3 years ago