blob: ab2a823eb9ce84c827016243ab24b42a260dd4d4 [file] [log] [blame]
Karl Zhang3de5ab12021-05-31 11:45:48 +08001/*
2 * Copyright (c) 2020, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8/* This file defines information to track regarding variables in the generated test
9 code. */
10
11#include <string>
12#include <vector>
13#include <list>
14#include <iostream>
15#include <fstream>
16
17#include "class_forwards.hpp"
18
19#include "data_blocks.hpp"
20#include "psa_asset.hpp"
21#include "crypto_asset.hpp"
22#include "psa_call.hpp"
23#include "find_or_create_asset.hpp"
24#include "variables.hpp"
25#include "gibberish.hpp"
26
27/* This project's header files #including other project headers quickly becomes
28 unrealistically complicated. The only solution is for each .cpp to include
29 the headers it needs. However these in particular are mostly axiomatic: Not
30 dependent upon other classes. */
31
32
33using namespace std;
34
35
36/**********************************************************************************
37 Methods of class variable_info follow:
38**********************************************************************************/
39
40variable_info::variable_info (void) // (default constructor)
41{
42 gibberish *gib = new gibberish;
43
44 hash_declared = value_known = false;
45 name = "";
46 length = 100 + (rand() % 800);
47 gib->sentence ((char*) value, (char*) value + length);
48 // TODO: Sizes of random data neesds to be strategized better
49 type = psa_asset_type::unknown;
50 delete gib;
51}
52
53variable_info::variable_info (string var_name, psa_asset_type var_type)
54{ // (constructor with known name and type)
55 gibberish *gib = new gibberish;
56
57 hash_declared = value_known = false;
58 name.assign (var_name);
59 length = 100 + (rand() % 800);
60 gib->sentence ((char*) value, (char*) value + length);
61 // TODO: Sizes of random data needs to be strategized better
62 type = var_type;
63 delete gib;
64}
65
66variable_info::~variable_info (void) // (destructor)
67{}
68
69
70/**********************************************************************************
71 End of methods of class variable_info.
72**********************************************************************************/