"GDB symbol object", /*tp_doc */
0, /*tp_traverse */
0, /*tp_clear */
- 0, /*tp_richcompare */
+ gdbpy_richcompare<symbol_object, symbol, &symbol_object::symbol>,
+ /*tp_richcompare */
0, /*tp_weaklistoffset */
0, /*tp_iter */
0, /*tp_iternext */
}
gdb_test "python print (t\[0\].symtab)" "${py_symbol_c}" "get symtab"
+# Test comparison for equality and non-equality
+gdb_test "python print (t\[0\] == t\[0\] )"\
+ "True" \
+ "test symbol equality with itself"
+gdb_test "python print (t\[0\] == a\[0\] )"\
+ "False" \
+ "test symbol equality with other symbol"
+gdb_test "python print (t\[0\] == 123 )"\
+ "False" \
+ "test symbol equality with non-symbol"
+
+gdb_test "python print (t\[0\] != t\[0\] )"\
+ "False" \
+ "test symbol non-equality with itself"
+gdb_test "python print (t\[0\] != a\[0\] )"\
+ "True" \
+ "test symbol non-equality with other symbol"
+gdb_test "python print (t\[0\] != 123 )"\
+ "True" \
+ "test symbol non-equality with non-symbol"
+
# C++ tests
# Recompile binary.
lappend opts c++