blob: ab57bf228ff92588b7791b7b0a92466938f78f10 [file] [log] [blame]
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import hashlib
class TestResult:
""" This simple class contains all the information about a single test.
This is used to report all the results and the information describing the
test for a user to understand what happened.
A TestResult object contains:
* A list of all the Validator Result objects
* The prompt given to the user to describe the gesture
* An image generated by the plotter (showing where the fingers were)
* A unique ID made from hashing all the other contents to id this test.
"""
def __init__(self, variation, validator_results, prompt, image,
timestamp=None):
self.variation = variation
self.validator_results = validator_results
self.prompt = prompt
self.image = image
self.timestamp = timestamp
if self.timestamp is None:
self.timestamp = datetime.datetime.now()
m = hashlib.md5()
m.update(self.prompt)
m.update(self.image)
for result in self.validator_results:
m.update(str(result))
self.test_id = m.hexdigest()