11const fs = require ( 'fs' ) ;
22
3- const PROBLEMS_FOLDER = './LeetcodeProblems /' ;
3+ const TESTS_FOLDER = './LeetcodeProblemsTests /' ;
44const REGEX_PATTERN_HIDDEN_FILES = / ( ^ | \/ ) \. [ ^ \/ \. ] / g;
55
66var main = async function ( ) {
77 try {
88 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 ] ) ;
1212
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" ) ;
1616 } 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." ) ;
1818 }
1919 }
2020 } catch ( error ) {
@@ -24,7 +24,7 @@ var main = async function() {
2424
2525var loadProblems = ( ) => {
2626 return new Promise ( function ( resolve , reject ) {
27- fs . readdir ( PROBLEMS_FOLDER , ( error , files ) => {
27+ fs . readdir ( TESTS_FOLDER , ( error , files ) => {
2828 if ( error ) {
2929 reject ( error ) ;
3030 } else {
0 commit comments