<commit_before>import assert from 'node:assert/strict'
import fs from 'node:fs'
import { normalize } from 'node:path'

import { join, fileShortPath, genCurrentDirname } from '@waiting/shared-core'

import {
  DModel as M,
  DTypes as W,
  DStruct as DS,
} from '../src/index.js'
import * as Win from '../src/index.js'


const __dirname = genCurrentDirname(import.meta.url)
const dllDir = normalize(join(__dirname, '/../src/lib/'))
const dlls: string[] = []

for (const key of fs.readdirSync(dllDir)) {
  const dll = normalize(dllDir + key)
  const stat = fs.statSync(dll)
  if (stat.isDirectory()) {
    dlls.push(key)
  }
}

describe(fileShortPath(import.meta.url), () => {

  for (const dll of dlls) {
    const apiName: string = dll.slice(0, 1).toUpperCase() + dll.slice(1).toLowerCase() // User32, Kernel32, ...
    console.log({ apiName })
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    const module = Win[apiName]
    assert(module)

    describe(apiName, () => {

      it('normal', async () => {
        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
        if (module && module.apiDef) {
          // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
          const api = module.load() as M.DllFuncs<commit_msg>test: log<commit_after>import assert from 'node:assert/strict'
import fs from 'node:fs'
import { normalize } from 'node:path'

import { join, fileShortPath, genCurrentDirname } from '@waiting/shared-core'

import {
  DModel as M,
  DTypes as W,
  DStruct as DS,
} from '../src/index.js'
import * as Win from '../src/index.js'


const __dirname = genCurrentDirname(import.meta.url)
const dllDir = normalize(join(__dirname, '/../src/lib/'))
const dlls: string[] = []

for (const key of fs.readdirSync(dllDir)) {
  const dll = normalize(dllDir + key)
  const stat = fs.statSync(dll)
  if (stat.isDirectory()) {
    dlls.push(key)
  }
}

describe(fileShortPath(import.meta.url), () => {

  for (const dll of dlls) {
    const apiName: string = dll.slice(0, 1).toUpperCase() + dll.slice(1).toLowerCase() // User32, Kernel32, ...
    console.log({ apiName })
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    const module = Win[apiName]
    assert(module, `${apiName} is not found`)

    describe(apiName, () => {

      it('normal', async () => {
        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
        if (module && module.apiDef) {
          // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
          const api = module.load() as M.DllFuncs
{'fraction_non_alphanumeric': 0.1559984668455347, 'fraction_numerical': 0.005366040628593331, 'mean_word_length': 3.3069306930693068, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6069270', 'n_tokens_mistral': 925, 'n_tokens_neox': 893, 'n_words': 198}