Node-Red configuration
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

varbinds.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* eslint-disable no-unused-expressions */
  2. var ber = require ('asn1-ber').Ber;
  3. var assert = require('assert');
  4. var snmp = require('../');
  5. describe('parseInt()', function() {
  6. describe('given a negative integer', function() {
  7. var writer = new ber.Writer();
  8. writer.writeInt(-3);
  9. var reader = new ber.Reader(writer.buffer);
  10. it('returns a negative integer', function() {
  11. assert.equal(-3, snmp.ObjectParser.readInt(reader));
  12. });
  13. }),
  14. describe('given a positive integer', function() {
  15. var writer = new ber.Writer();
  16. writer.writeInt(3245689);
  17. var reader = new ber.Reader(writer.buffer);
  18. it('returns a positive integer', function() {
  19. assert.equal(3245689, snmp.ObjectParser.readInt(reader));
  20. });
  21. });
  22. });
  23. describe('parseUint()', function() {
  24. describe('given a positive integer', function() {
  25. var writer = new ber.Writer();
  26. writer.writeInt(3242425);
  27. var reader = new ber.Reader(writer.buffer);
  28. it('returns a positive integer', function() {
  29. assert.equal(3242425, snmp.ObjectParser.readUint(reader));
  30. });
  31. }),
  32. describe('given a negative integer', function() {
  33. var writer = new ber.Writer();
  34. writer.writeInt(-3);
  35. var reader = new ber.Reader(writer.buffer);
  36. it('returns a positive integer', function() {
  37. assert.equal(253, snmp.ObjectParser.readUint(reader));
  38. });
  39. });
  40. });