Skip to content

Commit

Permalink
Update test files
Browse files Browse the repository at this point in the history
  • Loading branch information
netalondon committed Feb 22, 2024
1 parent 08c6784 commit b830312
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions projects/src/project_01/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/01");
await resetBySuffix(fs, CHIPS, "tst");
await resetBySuffix(fs, CHIPS, "cmp");
await resetBySuffix(fs, CHIPS, ".tst");
await resetBySuffix(fs, CHIPS, ".cmp");
await fs.popd();
}
4 changes: 2 additions & 2 deletions projects/src/project_02/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/02");
await resetBySuffix(fs, CHIPS, "tst");
await resetBySuffix(fs, CHIPS, "cmp");
await resetBySuffix(fs, CHIPS, ".tst");
await resetBySuffix(fs, CHIPS, ".cmp");
await fs.popd();
}
4 changes: 2 additions & 2 deletions projects/src/project_03/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/03");
await resetBySuffix(fs, CHIPS, "tst");
await resetBySuffix(fs, CHIPS, "cmp");
await resetBySuffix(fs, CHIPS, ".tst");
await resetBySuffix(fs, CHIPS, ".cmp");
await fs.popd();
}
4 changes: 2 additions & 2 deletions projects/src/project_04/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/04");
await resetBySuffix(fs, TESTS, "tst");
await resetBySuffix(fs, TESTS, "cmp");
await resetBySuffix(fs, TESTS, ".tst");
await resetBySuffix(fs, TESTS, ".cmp");
await fs.popd();
}
4 changes: 2 additions & 2 deletions projects/src/project_05/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/05");
await resetBySuffix(fs, CHIPS, "tst");
await resetBySuffix(fs, CHIPS, "cmp");
await resetBySuffix(fs, CHIPS, ".tst");
await resetBySuffix(fs, CHIPS, ".cmp");
await fs.popd();
}
5 changes: 3 additions & 2 deletions projects/src/project_07/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/07");
await resetBySuffix(fs, VMS, "tst");
await resetBySuffix(fs, VMS, "cmp");
await resetBySuffix(fs, VMS, ".tst");
await resetBySuffix(fs, VMS, "VME.tst");
await resetBySuffix(fs, VMS, ".cmp");
await fs.popd();
}
5 changes: 3 additions & 2 deletions projects/src/project_08/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export async function resetFiles(fs: FileSystem): Promise<void> {

export async function resetTests(fs: FileSystem): Promise<void> {
await fs.pushd("/projects/08");
await resetBySuffix(fs, VMS, "tst");
await resetBySuffix(fs, VMS, "cmp");
await resetBySuffix(fs, VMS, ".tst");
await resetBySuffix(fs, VMS, "VME.tst");
await resetBySuffix(fs, VMS, ".cmp");
await fs.popd();
}
2 changes: 1 addition & 1 deletion projects/src/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function resetBySuffix(
) {
for (const [key, value] of Object.entries(tree)) {
if (typeof value === "string") {
if (key.endsWith(`.${suffix}`)) {
if (key.endsWith(`${suffix}`)) {
await fs.writeFile(key, value);
}
} else {
Expand Down
5 changes: 4 additions & 1 deletion web/src/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FileSystem } from "@davidsouther/jiffies/lib/esm/fs";
import { resetFiles, resetTests } from "@nand2tetris/projects/index";

const VERSION_KEY = "version";
const CURRENT_VERSION = 3;
const CURRENT_VERSION = 4;

export function getVersion() {
return Number(localStorage.getItem(VERSION_KEY) ?? "0");
Expand Down Expand Up @@ -43,4 +43,7 @@ const versionUpdates: Record<number, (fs: FileSystem) => Promise<void>> = {
2: async (fs: FileSystem) => {
await resetTests(fs, [1]);
},
3: async (fs: FileSystem) => {
await resetTests(fs);
},
};

0 comments on commit b830312

Please sign in to comment.