Skip to content

Commit

Permalink
Add test script for zufuliu/notepad4#875
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Oct 25, 2024
1 parent 68bdcb2 commit 3401885
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions script/Issue875.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os.path
import random

def GetFileExtList():
extList = ['empty']
path = 'assoc.log'
os.system(f'assoc > {path}')
if os.path.isfile(path):
with open(path, 'r', encoding='utf-8') as fd:
lines = fd.read().splitlines()
for line in lines:
index = line.find('=')
if index > 0:
extList.append(line[:index])
return extList

def MakeTestDir(dirCount, fileCount):
extList = GetFileExtList()
print(f'dir: {dirCount}, file: {fileCount}, file ext: {len(extList)}')
root = 'test'
if not os.path.exists(root):
os.makedirs(root)
for i in range(dirCount):
path = rf'{root}\{i}'
if not os.path.exists(path):
os.makedirs(path)
for i in range(fileCount):
ext = random.choice(extList)
path = rf'{root}\{i}{ext}'
if not os.path.exists(path):
with open(path, 'wb') as fd:
pass

# MakeTestDir(5000, 105_000)

0 comments on commit 3401885

Please sign in to comment.