1
1
const fs = require ( 'fs' ) ;
2
2
3
- const PROBLEMS_FOLDER = './LeetcodeProblems /' ;
3
+ const TESTS_FOLDER = './LeetcodeProblemsTests /' ;
4
4
const REGEX_PATTERN_HIDDEN_FILES = / ( ^ | \/ ) \. [ ^ \/ \. ] / g;
5
5
6
6
var main = async function ( ) {
7
7
try {
8
8
const problems = await loadProblems ( ) ;
9
- for ( i in problems ) {
10
- console . log ( "Solving: " + problems [ i ] + ":" ) ;
11
- const problem = require ( PROBLEMS_FOLDER + problems [ i ] ) ;
9
+ for ( i in problems ) {
10
+ console . log ( "Solving: " + problems [ i ] ) ;
11
+ const problem = require ( TESTS_FOLDER + problems [ i ] ) ;
12
12
13
- if ( typeof ( problem . main ) !== 'undefined' ) {
14
- problem . main ( ) ;
15
- console . log ( "End of the solution for : " + problems [ i ] + ", \n\n" ) ;
13
+ if ( typeof ( problem . test ) !== 'undefined' ) {
14
+ problem . test ( ) ;
15
+ console . log ( "End of the solution for : " + problems [ i ] + " \n\n" ) ;
16
16
} else {
17
- console . warn ( problem , "The problem " + problems [ i ] + " doesn't have a main method implemented." ) ;
17
+ console . warn ( problem , "The problem " + problems [ i ] + " doesn't have a test method implemented." ) ;
18
18
}
19
19
}
20
20
} catch ( error ) {
@@ -24,7 +24,7 @@ var main = async function() {
24
24
25
25
var loadProblems = ( ) => {
26
26
return new Promise ( function ( resolve , reject ) {
27
- fs . readdir ( PROBLEMS_FOLDER , ( error , files ) => {
27
+ fs . readdir ( TESTS_FOLDER , ( error , files ) => {
28
28
if ( error ) {
29
29
reject ( error ) ;
30
30
} else {
0 commit comments