Skip to content
Permalink
Browse files

Fix #60 again

  • Loading branch information
samchon committed Feb 8, 2020
1 parent aba8b67 commit 33f60dbd238e3136c9535f6d6ec767bce8e4da35
Showing with 36 additions and 23 deletions.
  1. +13 −8 .vscode/launch.json
  2. +3 −1 package.json
  3. +4 −1 src/benchmark/index.ts
  4. +13 −12 src/test/index.ts
  5. +3 −1 src/test/numeric/test_special_maths.ts
@@ -7,20 +7,25 @@
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"name": "TypeScript Test using TS-NODE",
"runtimeArgs": [
"-r",
"ts-node/register"
],
"args": [
"${workspaceRoot}/src/test/index.ts"
]
},
{
"type": "node",
"request": "launch",
"name": "JavaScript Test using SourceMap",
"program": "${workspaceRoot}/test/index.js",
"cwd": "${workspaceRoot}",

// TypeScript
"sourceMaps": true,
"outFiles": ["${workspaceRot}/**.js"]
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"port": 5858,
"outFiles": []
}
]
}
@@ -17,13 +17,15 @@
"compile": "tsc",
"dev": "tsc --watch",
"module": "tsc -p module.json",
"test": "node test"
"test": "node test",
"ts-test": "ts-node src/test"
},
"devDependencies": {
"@types/cli": "^0.11.19",
"@types/node": "^13.7.0",
"cli": "^1.0.1",
"source-map-support": "^0.5.16",
"ts-node": "^8.6.2",
"typedoc": "^0.14.2",
"typedoc-plugin-external-module-name": "^2.0.0",
"typescript": "^3.7.5"
@@ -1,4 +1,7 @@
import "source-map-support/register";
const EXTENSION = __filename.substr(-2);
if (EXTENSION === "js")
require("source-map-support").install();

import { FileSystem } from "./internal/FileSystem";

interface IModule
@@ -1,4 +1,7 @@
import "source-map-support/register";
const EXTENSION = __filename.substr(-2);
if (EXTENSION === "js")
require("source-map-support").install();

import cli from "cli";
import fs from "fs";

@@ -35,30 +38,28 @@ async function iterate(command: ICommand, path: string): Promise<void>
await iterate(command, currentPath);
continue;
}
else if (file.substr(-3) !== ".js" || currentPath === `${__dirname}/index.js`)
else if (file.substr(-3) !== `.${EXTENSION}` || currentPath === `${__dirname}/index.${EXTENSION}`)
continue;
else if (file.substr(0, 5) !== "test_")
continue;

let moduleName: string = file.substring(5, file.length - 3);
if (command.exclude && command.exclude === moduleName)
continue;
if (command.target && command.target !== moduleName)
continue;

let time: number = Date.now();
let external: IModule = await import(currentPath.substr(0, currentPath.length - 3));
for (let key in external)
{
// WHETHER TESTING TARGET OR NOT
if (key.substr(0, 5) !== "test_")
continue;

if (command.exclude && command.exclude === key.substr(5))
continue;
if (command.target && command.target !== key.substr(5))
continue;

// PRINT TITLE & ELAPSED TIME
process.stdout.write(" - " + key);

await external[key]();
console.log(`: ${StringUtil.numberFormat(Date.now() - time)} ms`);
let time: number = await measure(() => external[key]());

console.log(`: ${StringUtil.numberFormat(time)} ms`);
}
}
}
@@ -1,7 +1,9 @@
import * as fs from "fs";
import * as std from "../../index";

const PATH = __dirname + "/../../assets/samples/special_math";
const PATH = (__filename.substr(-2) === "ts")
? __dirname + "/../../../assets/samples/special_math"
: __dirname + "/../../assets/samples/special_math";

export function similar(x: number, y: number, precision = .05): boolean
{

0 comments on commit 33f60db

Please sign in to comment.
You can’t perform that action at this time.