<commit_before>#!/usr/bin/env lua -i

local lblink = require 'lblink'

print('LuaBlink version: ' .. lblink._VERSION)
print "\n"
print('VID: ' .. lblink.VID)
print('PID: ' .. lblink.PID)
print "\n\n"

b = lblink.open()<commit_msg>made test (slightly) more sophisticated<commit_after>#!/usr/bin/env lua 

-- figure out a better way to do this...
package.cpath = package.cpath .. ';' .. '../src/?.so'


local lblink = require 'lblink'

local numericvars = {'VID', 'PID' }
local stringvars = { '_VERSION' }
local functions = { 'enumerate', 'list', 'open' }


local function maketester(t)
   return function(library, name)
      assert(type(library[name]) == t, name .. ' not defined as a ' .. t .. '.')
   end
end


local testFunctionDefined = maketester('function')
local testStringsDefined = maketester('string')
local testNumericDefined = maketester('number')


for _,n in ipairs(numericvars) do
   testNumericDefined(lblink, n)
end


for _,s in ipairs(stringvars) do
   testStringsDefined(lblink, s)
end


for _,f in ipairs(functions) do
   testFunctionDefined(lblink, f)
end

print "Success"
{'fraction_non_alphanumeric': 0.15279048490393413, 'fraction_numerical': 0.0, 'mean_word_length': 4.018348623853211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7339928', 'n_tokens_mistral': 401, 'n_tokens_neox': 390, 'n_words': 103}