`timescale 1ns/1ps
`include "uvm_macros.svh"
import uvm_pkg::*;

class fact_common_item extends uvm_object;
  int value = 42;
  `uvm_object_utils_begin(fact_common_item)
    `uvm_field_int(value, UVM_DEFAULT)
  `uvm_object_utils_end
  function new(string name="item"); super.new(name); endfunction
endclass

// These existing subclasses use the base registration and supply type names.
class fact_type_a extends fact_common_item;
  function new(string name="a"); super.new(name); endfunction
  virtual function string get_type_name(); return "fact_type_a"; endfunction
endclass

class fact_type_b extends fact_common_item;
  function new(string name="b"); super.new(name); endfunction
  virtual function string get_type_name(); return "fact_type_b"; endfunction
endclass

module comparer_fact_probe;
  initial begin
    fact_type_a lhs = new();
    fact_type_b rhs = new();
    uvm_comparer cmp = new();
    bit equal, explicit_equal;
    $display("REVIEW|names_differ|%0d", lhs.get_type_name() != rhs.get_type_name());
    $display("REVIEW|same_wrapper|%0d", lhs.get_object_type() == rhs.get_object_type());
    cmp.check_type = 1;
    equal = lhs.compare(rhs, cmp);
    $display("REVIEW|check_type|%0d", cmp.check_type);
    $display("REVIEW|compare_equal|%0d", equal);
    explicit_equal = (lhs.get_type_name() == rhs.get_type_name()) && lhs.compare(rhs, cmp);
    $display("REVIEW|explicit_name_check_equal|%0d", explicit_equal);
    $display("REVIEW|done|1");
    $finish;
  end
endmodule
