UNPKG

ljswitchboard-ljm_special_addresses

Version:

This module allows Kipling to interface with LJM's special address/specific ip feature.

63 lines (57 loc) 1.4 kB
var q = require('q'); var ljm_ffi = require('ljm-ffi'); var ljm = ljm_ffi.load(); var criticalError = false; var stopTest = function(test, err) { test.ok(false, err); criticalError = true; test.done(); }; var deviceFound = false; var performTests = true; var DEBUG_TEST = false; var device_tests = { 'setUp': function(callback) { if(criticalError) { process.exit(1); } else { callback(); } }, 'tearDown': function(callback) { callback(); }, 'createDevice': function(test) { var ljmLibraryVersion = ljm.LJM_ReadLibraryConfigS('LJM_LIBRARY_VERSION', 0); console.log(''); console.log('**** get_ljm_version ****'); console.log(' - Installed LJM Library Version:', ljmLibraryVersion.Value); test.done(); }, }; var tests = {}; var functionKeys = Object.keys(device_tests); var getTest = function(testFunc, key) { var execTest = function(test) { // console.log(" > t7_basic_test - " + key); if(performTests) { testFunc(test); } else { console.log(" * Not Executing!!"); try { test.done(); } catch(err) { console.log("HERE", err); } } }; return execTest; }; functionKeys.forEach(function(functionKey) { if ((functionKey !== 'setUp') && (functionKey !== 'tearDown')) { tests[functionKey] = getTest(device_tests[functionKey], functionKey); } else { tests[functionKey] = device_tests[functionKey]; } }); exports.tests = tests;