当前位置: 首页 > news >正文

junit写搜索树测试

用法
   assertTrue(range.contains("Two"));

2个参数,右边错就打印左边.

AbstractSelfBalancingBinarySearchTree abt;

AbstractBinarySearchTree.Node node;

@Before

public void setUp() {

abt = new AbstractSelfBalancingBinarySearchTree() {

@Override

protected Node createNode(int value, Node parent, Node left, Node right) {

return new Node(value,parent,left,right);

                }

};

node = null;

}这是首先在测试里写的值,node指针

AbstractBinarySearchTree.Node其中每个节点具有一个键(key)和两个子节点,左子节点的键小于父节点的键,右子节点的键大于父节点的键。它是二叉搜索树节点的抽象类

在创建二叉搜索树时通常会定义一个具体的节点类来承 AbstractBinarySearchTree.Node 并实现其抽象方法

AbstractBinarySearchTree abt;  
AbstractBinarySearchTree.Node node;
这两行代码声明了两个类变量。第一个是AbstractBinarySearchTree类型的变量abt,第二个是AbstractBinarySearchTree.Node类型的变量node。这些变量在当前类中可以被使用,但还未被初始化。 


首先我们看看Heap_item

我们只通过了

这一个

传入一个对象

进入了

他们其中一个还有一个分支


要传入一个数组

float是一个x=3.0,y=4.0

给到了p,getx是coord[0]

gety是coord[2]


 为什么assert会错因为,给的各个参数类型不一样

    assertEquals(new Point2D().toString(), airport.getPoint2D().toString());用自己的tostring转为字符串比较就可以了


使用

http://www.lryc.cn/news/229881.html

相关文章:

  • 顺丰接口对接-订单创建与取消(java单元测试)
  • C++:OJ练习(每日练习!)
  • GPTs Hunter 是什么?
  • 【移远QuecPython】EC800M物联网开发板的硬件TIM定时器精准延时
  • HDU 1027:Ignatius and the Princess II ← next_permutation()
  • 主题讲座:全球增材制造现状与未来(暨香港科技大学广州|智能制造学域2024博士学位全额奖学金项目)
  • hugeGraph修改PropertyKey属性类型
  • vscode 访问本地或者远程docker环境
  • 人工智能与充电技术:携手共创智能充电新时代
  • 『自定义B站视频播放速度』
  • Java入门篇 之 继承
  • 如何计算掩膜图中多个封闭图形的面积
  • 【Nginx】CentOS 安装Nignx
  • idea 代码快捷键Mac版
  • 【NI-DAQmx入门】多通道数据采集
  • 回顾 — SFA:简化快速 AlexNet(模糊分类)
  • 基于51单片机PCF8591数字电压表数码管显示设计( proteus仿真+程序+设计报告+讲解视频)
  • 分发饼干(贪心算法+图解)
  • vue项目路由使用history模式,nginx配置,刷新页面显示404
  • redis的redis.service配置
  • 高频SQL50题(基础版)-3
  • OpenMMlab导出yolov3模型并用onnxruntime和tensorrt推理
  • 单链表的插入删除
  • github使用手册
  • 怎样做ChatGPT应用开发?
  • 漏洞-任意账号注册
  • 一个关于jdbc操作mysql和java基础练手的通讯录管理系统小项目
  • C++用条件变量实现线程安全的queue容器
  • EDA实验-----3-8译码器设计(QuartusII)
  • NFTScan | 11.06~11.12 NFT 市场热点汇总