Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions | Variables
unit_test.h File Reference
#include "vm/compiler/ffi/unit_test_custom_zone.h"
#include "platform/globals.h"

Go to the source code of this file.

Classes

class  dart::compiler::ffi::TestCaseBase
 
class  dart::compiler::ffi::RawTestCase
 

Namespaces

namespace  dart
 
namespace  dart::compiler
 
namespace  dart::compiler::ffi
 

Macros

#define UNIT_TEST_CASE_WITH_EXPECTATION(name, expectation)
 
#define UNIT_TEST_CASE(name)   UNIT_TEST_CASE_WITH_EXPECTATION(name, "Pass")
 
#define UNIT_TEST_CASE_WITH_ZONE_WITH_EXPECTATION(name, expectation)
 
#define UNIT_TEST_CASE_WITH_ZONE(name)    UNIT_TEST_CASE_WITH_ZONE_WITH_EXPECTATION(name, "Pass")
 

Functions

void dart::compiler::ffi::WriteToFile (char *path, const char *contents)
 
void dart::compiler::ffi::ReadFromFile (char *path, char **buffer_pointer)
 

Variables

const char * dart::compiler::ffi::kArch
 

Macro Definition Documentation

◆ UNIT_TEST_CASE

#define UNIT_TEST_CASE (   name)    UNIT_TEST_CASE_WITH_EXPECTATION(name, "Pass")

Definition at line 23 of file unit_test.h.

◆ UNIT_TEST_CASE_WITH_EXPECTATION

#define UNIT_TEST_CASE_WITH_EXPECTATION (   name,
  expectation 
)
Value:
void Dart_Test##name(); \
static const dart::compiler::ffi::RawTestCase kRegister##name( \
Dart_Test##name, #name, expectation); \
void Dart_Test##name()
const char * name
Definition fuchsia.cc:50

Definition at line 17 of file unit_test.h.

28 { \
29 dart::Zone zone; \
30 Dart_TestHelper##name(&zone); \
31 } \
32 static void Dart_TestHelper##name(dart::Zone* Z)
33
34#define UNIT_TEST_CASE_WITH_ZONE(name) \
35 UNIT_TEST_CASE_WITH_ZONE_WITH_EXPECTATION(name, "Pass")
36
37namespace dart {
38namespace compiler {
39namespace ffi {
40
41extern const char* kArch;
42extern const char* kOs;
43
44void WriteToFile(char* path, const char* contents);
45
46void ReadFromFile(char* path, char** buffer_pointer);
47
48class TestCaseBase {
49 public:
50 explicit TestCaseBase(const char* name, const char* expectation);
51 virtual ~TestCaseBase() {}
52
53 const char* name() const { return name_; }
54 const char* expectation() const { return expectation_; }
55
56 virtual void Run() = 0;
57 void RunTest();
58
59 static void RunAll();
60 static void RunAllRaw();
61
62 static bool update_expectations;
63
64 private:
65 static TestCaseBase* first_;
66 static TestCaseBase* tail_;
67
68 TestCaseBase* next_;
69 const char* name_;
70 const char* expectation_;
71
72 DISALLOW_COPY_AND_ASSIGN(TestCaseBase);
73};
74
75class RawTestCase : TestCaseBase {
76 public:
77 typedef void(RunEntry)();
78
79 RawTestCase(RunEntry* run, const char* name, const char* expectation)
80 : TestCaseBase(name, expectation), run_(run) {}
81 virtual void Run();
82
83 private:
84 RunEntry* const run_;
85};
86
87} // namespace ffi
88} // namespace compiler
89} // namespace dart
90
91#endif // RUNTIME_VM_COMPILER_FFI_UNIT_TEST_H_
#define Z
RawTestCase(RunEntry *run, const char *name, const char *expectation)
Definition unit_test.h:80
const char * name() const
Definition unit_test.h:54
TestCaseBase(const char *name, const char *expectation)
const char * expectation() const
Definition unit_test.h:55
void WriteToFile(char *path, const char *contents)
Definition unit_test.cc:20
const char * kArch
void ReadFromFile(char *path, char **buffer_pointer)
Definition unit_test.cc:31
const char * kOs
Definition unit_test.cc:17
Definition run.py:1
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition globals.h:581

◆ UNIT_TEST_CASE_WITH_ZONE

#define UNIT_TEST_CASE_WITH_ZONE (   name)     UNIT_TEST_CASE_WITH_ZONE_WITH_EXPECTATION(name, "Pass")

Definition at line 35 of file unit_test.h.

◆ UNIT_TEST_CASE_WITH_ZONE_WITH_EXPECTATION

#define UNIT_TEST_CASE_WITH_ZONE_WITH_EXPECTATION (   name,
  expectation 
)
Value:
static void Dart_TestHelper##name(dart::Zone* Z); \
UNIT_TEST_CASE_WITH_EXPECTATION(name, expectation) { \
dart::Zone zone; \
Dart_TestHelper##name(&zone); \
} \
static void Dart_TestHelper##name(dart::Zone* Z)

Definition at line 27 of file unit_test.h.

29 { \
30 dart::Zone zone; \
31 Dart_TestHelper##name(&zone); \
32 } \
33 static void Dart_TestHelper##name(dart::Zone* Z)