Lolly 1.4.27
Loading...
Searching...
No Matches
Classes | Functions
promise_test.cpp File Reference
#include "a_lolly_test.hpp"
#include "promise.hpp"
#include "string.hpp"
Include dependency graph for promise_test.cpp:

Go to the source code of this file.

Classes

class  promise_rep_int_add
 

Functions

bool test_same (tm_ostream &a, tm_ostream &b)
 
 TEST_CASE ("function eval")
 
 TEST_CASE ("function print")
 
 TEST_CASE ("operator <<")
 

Detailed Description

A unitest for promise.

Author
Paradisuman
Date
2023

Definition in file promise_test.cpp.

Function Documentation

◆ test_same()

bool test_same ( tm_ostream & a,
tm_ostream & b )

Definition at line 22 of file promise_test.cpp.

22 {
23 string sa= a.unbuffer ();
24 string sb= b.unbuffer ();
25
26 return sa == sb;
27}
blackbox b[13]
The list class represents a linked list.
Definition list.hpp:48
string unbuffer()

◆ TEST_CASE() [1/3]

TEST_CASE ( "function eval" )

Definition at line 29 of file promise_test.cpp.

29 {
34
35 CHECK (t1 () == 3);
36 CHECK (t2 () == 1);
37}
blackbox t1
blackbox t2
blackbox_rep * rep
Definition blackbox.hpp:27

◆ TEST_CASE() [2/3]

TEST_CASE ( "function print" )

Definition at line 39 of file promise_test.cpp.

39 {
43 _ostream1.buffer ();
44
45 SUBCASE ("if tm_ostream empty") {
47 _ostream2.buffer ();
48 _ostream2 << "promise";
49 t->print (_ostream1);
50
52 }
53
54 SUBCASE ("if tm_ostream not empty") {
56 _ostream2.buffer ();
57 _ostream2 << "testpromise";
58 _ostream1 << "test";
59
60 t->print (_ostream1);
61
63 }
64}
blackbox t[13]
bool test_same(tm_ostream &a, tm_ostream &b)

◆ TEST_CASE() [3/3]

TEST_CASE ( "operator <<" )

Definition at line 66 of file promise_test.cpp.

66 {
68
69 SUBCASE ("if promise null") {
72 _ostream1.buffer ();
73 _ostream2.buffer ();
74 _ostream2 << "(null)";
75 _ostream1 << t;
76
78 }
79
80 SUBCASE ("if promise not null") {
84 _ostream1.buffer ();
85 _ostream2.buffer ();
86 _ostream2 << "promise";
87 _ostream1 << t;
88
90 }
91}