aboutsummaryrefslogtreecommitdiff
path: root/src/args.py
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-05 14:04:41 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-05 14:04:41 +0200
commit6100010d6873845413aed22744470616992df603 (patch)
tree5cefcd46851d06e0d9e9b09f578c13649582d075 /src/args.py
parent8a351c6d267c55445de7b7b40b1de3b16305bd02 (diff)
downloadphilosophers_test-6100010d6873845413aed22744470616992df603.tar.gz
philosophers_test-6100010d6873845413aed22744470616992df603.tar.bz2
philosophers_test-6100010d6873845413aed22744470616992df603.zip
Readded should be dead test
Diffstat (limited to 'src/args.py')
-rw-r--r--src/args.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/args.py b/src/args.py
index 899ef3f..2cb5749 100644
--- a/src/args.py
+++ b/src/args.py
@@ -6,27 +6,44 @@
# By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/10/01 10:23:09 by cacharle #+# #+# #
-# Updated: 2020/10/01 10:33:00 by cacharle ### ########.fr #
+# Updated: 2020/10/05 14:03:42 by cacharle ### ########.fr #
# #
# ############################################################################ #
import argparse
+import textwrap
import config
+
def parse_args():
parser = argparse.ArgumentParser(
description="Philosophers test",
- formatter_class=argparse.RawTextHelpFormatter
+ formatter_class=argparse.RawTextHelpFormatter,
+ epilog=textwrap.dedent("""\
+ Tested:
+ - Take 2 forks before eating
+ - State switch in the correct order
+ think -> fork -> fork -> eat n times -> sleep
+ - Almost 0 delay between second fork taken and eat
+ - Die if the death timeout is expired
+ - No output after death
+ - Timestamp in order
+ - Only take existing fork
+ - Error message and status != 0 on argument error
+ (not asked by subject but easy to do and cleanner)
+ """)
)
parser.add_argument(
"-p", "--philo",
- help="Id of the philosopher program to test \n"
- "- 1: philo_one\n"
- "- 2: philo_two\n"
- "- 3: philo_three\n"
- "- 0: all programs\n",
+ help=textwrap.dedent("""\
+ Number of the philosopher program to test
+ - 1: philo_one
+ - 2: philo_two
+ - 3: philo_three
+ - 0: all programs
+ """),
required=True,
type=int,
choices=[0, 1, 2, 3]