diff options
| -rw-r--r-- | src/args.py | 6 | ||||
| -rw-r--r-- | src/philo/log.py | 9 | ||||
| -rw-r--r-- | src/philo/philo.py | 2 | ||||
| -rw-r--r-- | src/suite.py | 20 | ||||
| -rw-r--r-- | src/test.py | 3 |
5 files changed, 18 insertions, 22 deletions
diff --git a/src/args.py b/src/args.py index 2cb5749..8fb9b5f 100644 --- a/src/args.py +++ b/src/args.py @@ -6,7 +6,7 @@ # By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/10/01 10:23:09 by cacharle #+# #+# # -# Updated: 2020/10/05 14:03:42 by cacharle ### ########.fr # +# Updated: 2021/01/03 13:32:55 by cacharle ### ########.fr # # # # ############################################################################ # @@ -44,9 +44,9 @@ def parse_args(): - 3: philo_three - 0: all programs """), - required=True, type=int, - choices=[0, 1, 2, 3] + choices=[0, 1, 2, 3], + default=0 ) parser.add_argument( "-b", "--build", diff --git a/src/philo/log.py b/src/philo/log.py index a07b734..8094688 100644 --- a/src/philo/log.py +++ b/src/philo/log.py @@ -6,7 +6,7 @@ # By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/10/01 10:51:39 by cacharle #+# #+# # -# Updated: 2020/10/05 13:52:51 by cacharle ### ########.fr # +# Updated: 2021/01/03 13:28:20 by cacharle ### ########.fr # # # # ############################################################################ # @@ -29,15 +29,14 @@ class Log: self._line = line self.id = self._parse_ranged_int(match.group("id"), 1, philo_num) - self.timestamp = self._parse_ranged_int( - match.group("timestamp"), start_time, end_time) + self.timestamp = self._parse_ranged_int(match.group("timestamp")) self.event = Event.from_string(match.group('event')) - def _parse_ranged_int(self, s, lo, hi): + def _parse_ranged_int(self, s, lo=None, hi=None): try: value = int(s) - if not (lo <= value <= hi): + if lo is not None and not (lo <= value <= hi): raise philo.error.Format( self._line, "{} should be between {} - {}".format(s, lo, hi) diff --git a/src/philo/philo.py b/src/philo/philo.py index 3565c41..09bbc64 100644 --- a/src/philo/philo.py +++ b/src/philo/philo.py @@ -6,7 +6,7 @@ # By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/10/01 10:52:56 by cacharle #+# #+# # -# Updated: 2020/12/30 14:29:30 by charles ### ########.fr # +# Updated: 2021/01/10 15:35:14 by cacharle ### ########.fr # # # # ############################################################################ # diff --git a/src/suite.py b/src/suite.py index 0491dd9..a2279b2 100644 --- a/src/suite.py +++ b/src/suite.py @@ -6,7 +6,7 @@ # By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/10/01 10:41:43 by cacharle #+# #+# # -# Updated: 2020/12/30 14:15:55 by charles ### ########.fr # +# Updated: 2021/01/10 15:34:52 by cacharle ### ########.fr # # # # ############################################################################ # @@ -40,16 +40,14 @@ def suite(): Test.new_error(["10", "10", "10", str(-config.UINT_MAX)]) Test.new_error(["10", "10", "10", "10", str(-config.UINT_MAX)]) - Test(0, 100, 100, 100) - Test(1, 100, 100, 100) - - Test(2, 200, 100, 100) - Test(3, 200, 100, 100) - Test(4, 200, 100, 100) - Test(5, 200, 100, 100) - Test(6, 200, 100, 100) - Test(7, 200, 100, 100) - + Test(0, 120, 60, 60) + Test(1, 120, 60, 60) + Test(2, 120, 60, 60) + Test(3, 120, 60, 60) + Test(4, 120, 60, 60) + Test(5, 120, 60, 60) + Test(6, 120, 60, 60) + Test(7, 120, 60, 60) Test(5, 800, 200, 200) Test(5, 800, 200, 200, 7) Test(4, 410, 200, 200) diff --git a/src/test.py b/src/test.py index 4312858..b009322 100644 --- a/src/test.py +++ b/src/test.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/27 11:36:32 by charles #+# #+# # -# Updated: 2020/10/05 13:50:01 by cacharle ### ########.fr # +# Updated: 2021/01/03 13:53:38 by cacharle ### ########.fr # # # # ############################################################################ # @@ -89,7 +89,6 @@ class Test: try: out, err = process.communicate(timeout=config.TIMEOUT) - # process.terminate() except subprocess.TimeoutExpired: process.kill() out, err = process.communicate() |
