From 8a10dbcf27bc9502aeb41585feb32f25c602bec4 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 26 Dec 2021 16:01:36 +0200 Subject: [PATCH] vlib: rename `adt` to `datatypes` --- vlib/{adt => datatypes}/README.md | 4 ++-- vlib/{adt => datatypes}/doubly_linked_list.v | 2 +- .../{adt => datatypes}/doubly_linked_list_test.v | 2 +- vlib/{adt => datatypes}/heap.v | 2 +- vlib/{adt => datatypes}/heap_test.v | 2 +- vlib/{adt => datatypes}/linked_list.v | 2 +- vlib/{adt => datatypes}/linked_list_test.v | 2 +- vlib/{adt => datatypes}/queue.v | 2 +- vlib/{adt => datatypes}/queue_test.v | 2 +- vlib/{adt => datatypes}/stack.v | 2 +- vlib/{adt => datatypes}/stack_test.v | 16 ++++++++-------- 11 files changed, 19 insertions(+), 19 deletions(-) rename vlib/{adt => datatypes}/README.md (93%) rename vlib/{adt => datatypes}/doubly_linked_list.v (99%) rename vlib/{adt => datatypes}/doubly_linked_list_test.v (99%) rename vlib/{adt => datatypes}/heap.v (99%) rename vlib/{adt => datatypes}/heap_test.v (98%) rename vlib/{adt => datatypes}/linked_list.v (99%) rename vlib/{adt => datatypes}/linked_list_test.v (99%) rename vlib/{adt => datatypes}/queue.v (98%) rename vlib/{adt => datatypes}/queue_test.v (98%) rename vlib/{adt => datatypes}/stack.v (98%) rename vlib/{adt => datatypes}/stack_test.v (76%) diff --git a/vlib/adt/README.md b/vlib/datatypes/README.md similarity index 93% rename from vlib/adt/README.md rename to vlib/datatypes/README.md index 6aa01d81bf..8e9dbdf627 100644 --- a/vlib/adt/README.md +++ b/vlib/datatypes/README.md @@ -12,9 +12,9 @@ be more suitable for your specific application. It is implemented using generics, that you have to specialise for the type of your actual elements. For example: ```v -import adt +import datatypes -mut stack := adt.Stack{} +mut stack := datatypes.Stack{} stack.push(1) println(stack) ``` diff --git a/vlib/adt/doubly_linked_list.v b/vlib/datatypes/doubly_linked_list.v similarity index 99% rename from vlib/adt/doubly_linked_list.v rename to vlib/datatypes/doubly_linked_list.v index e02920e8b9..450e31420c 100644 --- a/vlib/adt/doubly_linked_list.v +++ b/vlib/datatypes/doubly_linked_list.v @@ -1,4 +1,4 @@ -module adt +module datatypes struct DoublyListNode { mut: diff --git a/vlib/adt/doubly_linked_list_test.v b/vlib/datatypes/doubly_linked_list_test.v similarity index 99% rename from vlib/adt/doubly_linked_list_test.v rename to vlib/datatypes/doubly_linked_list_test.v index 5668aeda3c..43193afcdf 100644 --- a/vlib/adt/doubly_linked_list_test.v +++ b/vlib/datatypes/doubly_linked_list_test.v @@ -1,4 +1,4 @@ -module adt +module datatypes fn test_is_empty() { mut list := DoublyLinkedList{} diff --git a/vlib/adt/heap.v b/vlib/datatypes/heap.v similarity index 99% rename from vlib/adt/heap.v rename to vlib/datatypes/heap.v index b5fd5a3658..3c73123d5e 100644 --- a/vlib/adt/heap.v +++ b/vlib/datatypes/heap.v @@ -1,4 +1,4 @@ -module adt +module datatypes // MinHeap is a binary minimum heap data structure. pub struct MinHeap { diff --git a/vlib/adt/heap_test.v b/vlib/datatypes/heap_test.v similarity index 98% rename from vlib/adt/heap_test.v rename to vlib/datatypes/heap_test.v index 51a535dc94..bb3087fb96 100644 --- a/vlib/adt/heap_test.v +++ b/vlib/datatypes/heap_test.v @@ -1,4 +1,4 @@ -module adt +module datatypes fn test_min_heap() ? { mut heap := MinHeap{} diff --git a/vlib/adt/linked_list.v b/vlib/datatypes/linked_list.v similarity index 99% rename from vlib/adt/linked_list.v rename to vlib/datatypes/linked_list.v index 7855ee1f57..0bc17c4597 100644 --- a/vlib/adt/linked_list.v +++ b/vlib/datatypes/linked_list.v @@ -1,4 +1,4 @@ -module adt +module datatypes pub struct ListNode { mut: diff --git a/vlib/adt/linked_list_test.v b/vlib/datatypes/linked_list_test.v similarity index 99% rename from vlib/adt/linked_list_test.v rename to vlib/datatypes/linked_list_test.v index 0e66be05d7..4fee4bf71d 100644 --- a/vlib/adt/linked_list_test.v +++ b/vlib/datatypes/linked_list_test.v @@ -1,4 +1,4 @@ -module adt +module datatypes fn test_is_empty() { mut list := LinkedList{} diff --git a/vlib/adt/queue.v b/vlib/datatypes/queue.v similarity index 98% rename from vlib/adt/queue.v rename to vlib/datatypes/queue.v index bda51c55eb..ed1317b38f 100644 --- a/vlib/adt/queue.v +++ b/vlib/datatypes/queue.v @@ -1,4 +1,4 @@ -module adt +module datatypes pub struct Queue { mut: diff --git a/vlib/adt/queue_test.v b/vlib/datatypes/queue_test.v similarity index 98% rename from vlib/adt/queue_test.v rename to vlib/datatypes/queue_test.v index 499a2a192a..98cadc641b 100644 --- a/vlib/adt/queue_test.v +++ b/vlib/datatypes/queue_test.v @@ -1,4 +1,4 @@ -module adt +module datatypes fn test_is_empty() { mut queue := Queue{} diff --git a/vlib/adt/stack.v b/vlib/datatypes/stack.v similarity index 98% rename from vlib/adt/stack.v rename to vlib/datatypes/stack.v index 7e42842eff..ac6b5600c0 100644 --- a/vlib/adt/stack.v +++ b/vlib/datatypes/stack.v @@ -1,4 +1,4 @@ -module adt +module datatypes pub struct Stack { mut: diff --git a/vlib/adt/stack_test.v b/vlib/datatypes/stack_test.v similarity index 76% rename from vlib/adt/stack_test.v rename to vlib/datatypes/stack_test.v index 84c1a2a761..12a84e14f9 100644 --- a/vlib/adt/stack_test.v +++ b/vlib/datatypes/stack_test.v @@ -1,14 +1,14 @@ -import adt +import datatypes as dt fn test_is_empty() { - mut stack := adt.Stack{} + mut stack := dt.Stack{} assert stack.is_empty() == true stack.push(1) assert stack.is_empty() == false } fn test_len() ? { - mut stack := adt.Stack{} + mut stack := dt.Stack{} assert stack.len() == 0 stack.push(1) assert stack.len() == 1 @@ -17,18 +17,18 @@ fn test_len() ? { } fn test_peek() ? { - mut stack := adt.Stack{} + mut stack := dt.Stack{} stack.push(1) assert stack.peek() ? == 1 stack.push(2) assert stack.peek() ? == 2 - stack = adt.Stack{} + stack = dt.Stack{} stack.peek() or { return } assert false } fn test_push() ? { - mut stack := adt.Stack{} + mut stack := dt.Stack{} stack.push(1) assert stack.peek() ? == 1 stack.push(2) @@ -38,7 +38,7 @@ fn test_push() ? { } fn test_pop() ? { - mut stack := adt.Stack{} + mut stack := dt.Stack{} stack.push(1) stack.push(2) stack.push(3) @@ -46,7 +46,7 @@ fn test_pop() ? { stack.push(4) assert stack.pop() ? == 4 assert stack.pop() ? == 2 - stack = adt.Stack{} + stack = dt.Stack{} stack.pop() or { return } assert false }