- Fixed bug that was causing more non-unique UUIDs.  Here are the
  changes made:
    - Task.cpp, tasks are no longer provided with a UUID in Task::Task.
      This prevents the global context.task from being constructed before
      srandom/srand is called.
    - main.cpp, instead of srandom/srand (time (NULL)), it now uses
      struct timeval tv_usec member, which has a micro-second granularity,
      instead of time (NULL) which has a second granularity.  When
      "task add ..." is called in a unit test, several calls are made per
      second, this the random number generator is seeded with the same
      value.
    - Modified the unit test to cover all 6 tasks created, instead of
      5.
This commit is contained in:
Paul Beckingham 2009-07-05 23:59:11 -04:00
parent 28ab9e36cd
commit 51ad77e952
3 changed files with 12 additions and 7 deletions

View file

@ -73,8 +73,13 @@ $output = qx{../task rc:uuid.rc 5 info};
push @all_uuids, $uuid;
$unique_uuids{$uuid} = undef;
is (scalar (@all_uuids), 5, '5 tasks created');
is (scalar (keys %unique_uuids), 5, '5 unique UUIDs');
$output = qx{../task rc:uuid.rc 6 info};
($uuid) = $output =~ /UUID\s+(\S+)/;
push @all_uuids, $uuid;
$unique_uuids{$uuid} = undef;
is (scalar (@all_uuids), 6, '6 tasks created');
is (scalar (keys %unique_uuids), 6, '6 unique UUIDs');
# Cleanup.
unlink 'pending.data';