forked from b00tc4mp/isdi-parttime-202406
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
carlos
committed
Sep 12, 2024
1 parent
bc79788
commit 4295197
Showing
2 changed files
with
17 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,47 @@ | ||
|
||
const ChainCharacters = require("./"); | ||
|
||
function compare(array1, array2) { | ||
let result = true; | ||
let i = 0; | ||
if (array1.length !== array2.length) return false; | ||
while (i < array1.length) { | ||
if (array1[i].value !== array2[i]) { | ||
result = false; | ||
} | ||
i++; | ||
function compare(arr1, arr2) { | ||
if (arr1.length !== arr2.length) return false; | ||
let result = true; | ||
let i = 0; | ||
while (i < arr1.length && result === false) { | ||
if (arr1[i] !== arr2[i]) { | ||
result = false; | ||
} | ||
return result; | ||
i++; | ||
} | ||
return result; | ||
} | ||
|
||
|
||
//const str = 'Esta es una oración que tiene que estar split.'; | ||
const str = 'Esta es una oración que tiene que estar split.'; | ||
const pattern = ""; | ||
const pattern2 = " "; | ||
const pattern3 = "q"; | ||
const pattern4 = "e"; | ||
|
||
//const result1 = split(str, pattern); | ||
//const result2 = split(str, pattern2); | ||
//const result3 = split(str, pattern3); | ||
//const result4 = split(str, pattern4); | ||
|
||
|
||
const result1 = new ChainCharacters('Esta es una oración que tiene que estar split.').split(pattern); | ||
console.assert(compare(result1, 'Esta es una oración que tiene que estar split.'.split(pattern)),{ | ||
const result1 = new ChainCharacters(str).split(pattern); | ||
console.assert(compare(result1, str.split(pattern)),{ | ||
result: result1, | ||
message: "Test 1 No pasado ", | ||
}); | ||
|
||
/* | ||
const result2 = new ChainCharacters(str).split(pattern2); | ||
console.assert(compare(result2, str.split(pattern2)),{ | ||
result: result2, | ||
message: "Test 2 No pasado ", | ||
}); | ||
|
||
const result3 = new ChainCharacters(str).split(pattern3) | ||
console.assert(compare(result3, str.split(pattern3)),{ | ||
result: result3, | ||
message: "Test 3 No pasado ", | ||
}); | ||
|
||
const result4 = new ChainCharacters(str).split(pattern4) | ||
console.assert(compare(result4, str.split(pattern4)),{ | ||
result: result4, | ||
message: "Test 3 No pasado ", | ||
}); | ||
*/ | ||
|