Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

テストコード2 #20

Closed
4 tasks done
stakiran opened this issue Dec 15, 2020 · 13 comments
Closed
4 tasks done

テストコード2 #20

stakiran opened this issue Dec 15, 2020 · 13 comments

Comments

@stakiran
Copy link
Member

stakiran commented Dec 15, 2020

#15 の続き

  • add
  • copy
  • start and end simply
  • start and end all cases
@stakiran stakiran mentioned this issue Dec 15, 2020
9 tasks
@stakiran
Copy link
Member Author

最低限やる(操作系)

		task_add,
		inbox_add,
		task_copy,
		sort,
		task_start,
		task_end,
		task_walk,
		task_walk_plus1,
		task_walk_to_today,
		completion_simple,

どうする?(カーソル移動系) 🐰 たぶんやらない

		jump_to_today_todo,
		jump_to_starting,
		jump_to_prev_separator,
		jump_to_next_separator,

@stakiran
Copy link
Member Author

  • テストコードは必要最小限にする
  • helper.py のテストはするな、VSCode 部分のテストをせよ
  • できればファイル操作(save)もしたくない

@stakiran
Copy link
Member Author

stakiran commented Dec 16, 2020

まずは最低限以下をつくる

  • add
  • copy
  • start and end simply
  • start and end all cases

@stakiran
Copy link
Member Author

優先順位

  • 1 上記最低限たち
  • 2 カーソル移動系
  • 3 helper.py が絡む操作

2 も VSCode の処理だから、やはりやりたいか……

@stakiran
Copy link
Member Author

stakiran commented Dec 16, 2020

でもカーソル移動系はデバッグ時でもバリバリ使うから、狂ってもわかるよなぁ。あえて労して書くほどの価値はない。

が、ガチでカーソル位置に気を配って本当に使いやすいブツを作りたいなら、突き詰めるべきだろう。……が、 #3 で少なくとも吹っ飛ぶのは制御できないとわかってるので突き詰めはたかが知れている……。

@stakiran
Copy link
Member Author

stakiran commented Dec 16, 2020

☝️ まとめ

処理は以下に分類できる。

  • 1 単純操作系
  • 2 ジャンプ系
  • 3 ヘルパー系

テストコードは 1 のみ書く。

  • 2 はデバッグ時など手動かしてる時にもバシバシ使うし、テストコード書く労力もでかいのでしない
  • 3 は helper.py の領分であり、tritask-sta でやってるのでしない

@stakiran
Copy link
Member Author

copy どうしようかな

  • starttime と endtime は省く
  • rep があったら repeat if possible する

なので、start end と一緒にやる。

  • 0 inbox
  • 1 added task
  • 2 starting task
  • 3 done task
  • 0をコピーしたもの
  • 1をコピーしたもの
  • 2をコピーしたもの
  • 3をコピーしたもの

必要な操作は、

  • description を記入する
  • 指定行に移動する(からのstart, end)

@stakiran
Copy link
Member Author

テストコードこんな感じになってる

	test('start, end and copy task', async () => {
		let isSuccess = false

		isSuccess = await addInbox()
		assertTrue(isSuccess)
		isSuccess = await addTask()
		assertTrue(isSuccess)
		isSuccess = await addTask()
		assertTrue(isSuccess)
		isSuccess = await addTask()
		assertTrue(isSuccess)

		// line:0 4 add / これは todo task にする
		// line:1 3 add / これは starting task にする
		// line:2 2 add / これは done task にする
		// line:3 1 inbox
		IDE.goLineAt(1)
		await startTask()
		IDE.goLineAt(2)
		await startTask()
		await endTask()

		assertTodo(L(0))
		assertStarting(L(1))
		assertDone(L(2))
		assertInbox(L(3))

		// line:0 4 add / これは todo task にする
		// line:1 同上コピー <= todo のまま
		// line:2 3 add / これは starting task にする
		// line:3 同上コピー <= todo になる
		// line:4 2 add / これは done task にする
		// line:5 同上コピー <= todo になる
		// line:6 1 inbox
		// line:7 同上コピー <= inbox のまま
		//
		// コピーは上から順に行うが, 間にコピーされた行がはさまるので 2 行ずつズレながらやれば良い.
		IDE.goLineAt(0)
		await copyTask()
		IDE.goLineAt(2)
		await copyTask()
		IDE.goLineAt(4)
		await copyTask()
		IDE.goLineAt(6)
		await copyTask()

		assertTodo(L(1))
		assertTodo(L(3))
		assertTodo(L(5))
		assertInbox(L(7))
	});

あまり整えすぎても仕方ないのでこれくらいでいいか

@stakiran
Copy link
Member Author

stakiran commented Dec 18, 2020

テストコードかかる時間

tritask_testcode

  Test tritask operations on the VSCode Editor layer.
    √ add task and inbox (93ms)
    √ start, end and copy task (112ms)
Object
    √ peek current document
  3 passing (289ms

2-3s くらい

@stakiran
Copy link
Member Author

start end varietion

なんかコメントで説明してて不吉な気がしないでもないが、コードでリーダブルに説明させると過剰になるだろうし、これでいいか

	test('start and end all case', async () => {
		let isSuccess = false

		isSuccess = await addTask()
		assertTrue(isSuccess)
		assertTodo(L(0))

		IDE.goLineAt(0)

		// (start) (end)
		// o が time 記入している, x がしていない.
		//
		// o o -> o x  Pattern1
		// o o -> x o  Pattern2
		// o o -> x x  しない. 2step
		// o x -> o o  Pattern1
		// o x -> x x  Pattern1
		// o x -> x o  しない. 2step
		// x o -> o x  Don't care(加えて2step)
		// x o -> o o  Don't care
		// x o -> x x  Don't care
		// x x -> o o  しない. 2step
		// x x -> o x  Pattern1
		// x x -> x o  Pattern2

		// pattern1: x x -> o o -> x x と往復できるか
		// ---------

		// x x -> o x
		await startTask()
		assertStarting(L(0))

		// o x -> o o
		await endTask()
		assertDone(L(0))

		// o o -> o x
		await endTask()
		assertStarting(L(0))

		// o x -> x x
		await startTask()
		assertTodo(L(0))

		// pattern2: Don't care に至る入り口をガードできているか
		// ---------

		// x x -> x o はならない. 開始してないので終了できない.
		await endTask()
		assertTodo(L(0))

		// 事前に x x -> o o する.
		await startTask()
		await endTask()
		// o o -> x o はならない. 終了しているのに開始前にすることはできない.
		await startTask()
		assertDone(L(0))

	});

@stakiran
Copy link
Member Author

テストコード予定分はおわり

@stakiran
Copy link
Member Author

develop に合流する

@stakiran
Copy link
Member Author

a7d6722

合流しました。

testcode ブランチも消去済

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant