summaryrefslogtreecommitdiff
path: root/p83/test.go
diff options
context:
space:
mode:
Diffstat (limited to 'p83/test.go')
-rw-r--r--p83/test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/p83/test.go b/p83/test.go
new file mode 100644
index 0000000..11c3249
--- /dev/null
+++ b/p83/test.go
@@ -0,0 +1,40 @@
+package main
+
+
+import "fmt"
+import "math/rand"
+import "time"
+
+
+func main() {
+ rand.Seed(time.Now().Unix())
+
+ v := PQueue{}
+
+ n := rand.Int() % 5000 + 5000
+
+ for i := 0 ; i < n ; i++ {
+ if rand.Int()%10 == 2 && v.isEmpty() == false {
+ fmt.Println("🦊");
+ for j := 0 ; j < 10 && v.isEmpty() == false ; j++ {
+ fmt.Println( v.pop() )
+ }
+ fmt.Println(v)
+ } else {
+ v.push( rand.Int() % 200 )
+ fmt.Println
+ }
+ }
+
+ v.push(10)
+ fmt.Println(v)
+ v.push(20)
+ fmt.Println(v)
+ v.push(11)
+ fmt.Println(v)
+ v.push(31)
+ fmt.Println(v)
+ v.pop()
+
+ fmt.Println(v)
+}