/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to tests/utils/gobject_to_string.vala

  • Committer: Gustav Hartvigsson
  • Date: 2022-06-01 18:16:29 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20220601181629-meq45diu7dh8iied
Made sure that no text rows exeed 80 columns.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if 0
 
2
// This is just too hard to make a test for.
1
3
using GLib;
2
4
 
3
5
using Utils;
39
41
 
40
42
void gobject_to_string_test () {
41
43
  
42
 
//  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "int", () => {
43
 
//    var v1 = GLib.Object.new (typeof (MyTestClassInt),
44
 
//                                     prop_int: 1337);
45
 
//    string got_string = object_to_string (v1);
46
 
//    
47
 
//    debug (got_string);
48
 
//    
49
 
//    string expected = "(MyTestClassInt)}\n\t(gint) prop-int: 1337\n}";
50
 
//    
51
 
//    debug (expected);
52
 
//    
53
 
//    if (expected != got_string) {
54
 
//      Test.fail ();
55
 
//      Test.message ("The output sting does not match the expected string.");
56
 
//    }
57
 
//  });
58
 
//  
59
 
//  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "string", () => {
60
 
//    var v1 = GLib.Object.new (typeof (MyTestClassString),
61
 
//                                     prop_string: "string");
62
 
//    
63
 
//    string got_string = object_to_string (v1);
64
 
//    
65
 
//    debug (got_string);
66
 
//    
67
 
//    string expected = "(MyTestClassString):\n\t(gchararray) prop-string: string\n";
68
 
//    
69
 
//    debug (expected);
70
 
//    
71
 
//    if (expected != got_string) {
72
 
//      Test.fail ();
73
 
//      Test.message ("The output sting does not match the expected string.");
74
 
//    }
75
 
//  });
76
 
//  
77
 
//  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "bool", () => {
78
 
//    var v1 = GLib.Object.new (typeof (MyTestClassBool),
79
 
//                                     prop_bool: true);
80
 
//    
81
 
//    string got_string = object_to_string (v1);
82
 
//    
83
 
//    debug (got_string);
84
 
//    
85
 
//    string expected = "(MyTestClassBool):\n\t(gboolean) prop-bool: true\n";
86
 
//    
87
 
//    debug (expected);
88
 
//    
89
 
//    if (expected != got_string) {
90
 
//      Test.fail ();
91
 
//      Test.message ("The output sting does not match the expected string.");
92
 
//    }
93
 
//  });
94
 
//  
95
 
//  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "variant", () => {
96
 
//    var my_var = new Variant ("(ssibb)", "aa", "bb", 10, false, true);
97
 
//    var v1 = GLib.Object.new (typeof (MyTestClassVariant),
98
 
//                                     prop_var: my_var);
99
 
//    
100
 
//    string got_string = object_to_string (v1);
101
 
//    
102
 
//    debug (got_string);
103
 
//    
104
 
//    string expected = 
105
 
//"(MyTestClassVariant):
106
 
//\t(GVariant) prop-var: (ssibb)
107
 
//\t(
108
 
//\t\t((s): 'aa')
109
 
//\t\t((s): 'bb')
110
 
//\t\t((i): 10)
111
 
//\t\t((b): false)
112
 
//\t\t((b): true)
113
 
//\t)
114
 
//";
115
 
//    
116
 
//    debug (expected);
117
 
//    
118
 
//    if (str_cmp (expected, got_string) != 0) {
119
 
//      Test.fail ();
120
 
//      Test.message ("The output sting does not match the expected string.");
121
 
//    }
122
 
//  });
 
44
  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "int", () => {
 
45
    var v1 = GLib.Object.new (typeof (MyTestClassInt),
 
46
                                     prop_int: 1337);
 
47
    string got_string = object_to_string (v1);
 
48
    
 
49
    debug (got_string);
 
50
    
 
51
    string expected = "(MyTestClassInt)}\n\t(gint) prop-int: 1337\n}";
 
52
    
 
53
    debug (expected);
 
54
    
 
55
    if (expected != got_string) {
 
56
      Test.fail ();
 
57
      Test.message ("The output sting does not match the expected string.");
 
58
    }
 
59
  });
 
60
  
 
61
  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "string", () => {
 
62
    var v1 = GLib.Object.new (typeof (MyTestClassString),
 
63
                                     prop_string: "string");
 
64
    
 
65
    string got_string = object_to_string (v1);
 
66
    
 
67
    debug (got_string);
 
68
    
 
69
    string expected = "(MyTestClassString):\n\t(gchararray) prop-string: string\n";
 
70
    
 
71
    debug (expected);
 
72
    
 
73
    if (expected != got_string) {
 
74
      Test.fail ();
 
75
      Test.message ("The output sting does not match the expected string.");
 
76
    }
 
77
  });
 
78
  
 
79
  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "bool", () => {
 
80
    var v1 = GLib.Object.new (typeof (MyTestClassBool),
 
81
                                     prop_bool: true);
 
82
    
 
83
    string got_string = object_to_string (v1);
 
84
    
 
85
    debug (got_string);
 
86
    
 
87
    string expected = "(MyTestClassBool):\n\t(gboolean) prop-bool: true\n";
 
88
    
 
89
    debug (expected);
 
90
    
 
91
    if (expected != got_string) {
 
92
      Test.fail ();
 
93
      Test.message ("The output sting does not match the expected string.");
 
94
    }
 
95
  });
 
96
  
 
97
  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "variant", () => {
 
98
    var my_var = new Variant ("(ssibb)", "aa", "bb", 10, false, true);
 
99
    var v1 = GLib.Object.new (typeof (MyTestClassVariant),
 
100
                                     prop_var: my_var);
 
101
    
 
102
    string got_string = object_to_string (v1);
 
103
    
 
104
    debug (got_string);
 
105
    
 
106
    string expected = 
 
107
"(MyTestClassVariant):
 
108
\t(GVariant) prop-var: (ssibb)
 
109
\t(
 
110
\t\t((s): 'aa')
 
111
\t\t((s): 'bb')
 
112
\t\t((i): 10)
 
113
\t\t((b): false)
 
114
\t\t((b): true)
 
115
\t)
 
116
";
 
117
    
 
118
    debug (expected);
 
119
    
 
120
    if (str_cmp (expected, got_string) != 0) {
 
121
      Test.fail ();
 
122
      Test.message ("The output sting does not match the expected string.");
 
123
    }
 
124
  });
123
125
 
124
126
  Test.add_func (UTIL_TEST_GOBJECT_PREFIX + "/nested", () => {
125
127
    MyTestClassB obj = new MyTestClassB ();
135
137
 
136
138
  
137
139
}
 
140
 
 
141
#endif