pixivfe_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package main
  2. import (
  3. "net/http"
  4. "testing"
  5. )
  6. func Benchmark_Main(t *testing.B) {
  7. r, err := http.Get("http://localhost:8282/")
  8. if r.StatusCode != 200 {
  9. t.Errorf("Status code not 200: was %d", r.StatusCode)
  10. }
  11. if err != nil {
  12. t.Error(err)
  13. }
  14. }
  15. func Benchmark_Ranking(t *testing.B) {
  16. r, err := http.Get("http://localhost:8282/ranking")
  17. if r.StatusCode != 200 {
  18. t.Errorf("Status code not 200: was %d", r.StatusCode)
  19. }
  20. if err != nil {
  21. t.Error(err)
  22. }
  23. }
  24. func Benchmark_Ranking_Complex(t *testing.B) {
  25. r, err := http.Get("http://localhost:8282/ranking?content=all&mode=daily_r18&page=1&date=20230826")
  26. if r.StatusCode != 200 {
  27. t.Errorf("Status code not 200: was %d", r.StatusCode)
  28. }
  29. if err != nil {
  30. t.Error(err)
  31. }
  32. }
  33. func Benchmark_Artwork(t *testing.B) {
  34. r, err := http.Get("http://localhost:8282/artworks/111157207")
  35. if r.StatusCode != 200 {
  36. t.Errorf("Status code not 200: was %d", r.StatusCode)
  37. }
  38. if err != nil {
  39. t.Error(err)
  40. }
  41. }
  42. func Benchmark_Artwork_R18(t *testing.B) {
  43. r, err := http.Get("http://localhost:8282/artworks/111130033")
  44. if r.StatusCode != 200 {
  45. t.Errorf("Status code not 200: was %d", r.StatusCode)
  46. }
  47. if err != nil {
  48. t.Error(err)
  49. }
  50. }
  51. func Benchmark_User_NoSocial(t *testing.B) {
  52. r, err := http.Get("http://localhost:8282/users/1035047")
  53. if r.StatusCode != 200 {
  54. t.Errorf("Status code not 200: was %d", r.StatusCode)
  55. }
  56. if err != nil {
  57. t.Error(err)
  58. }
  59. }
  60. func Benchmark_User_WithSocial(t *testing.B) {
  61. r, err := http.Get("http://localhost:8282/users/59336265")
  62. if r.StatusCode != 200 {
  63. t.Errorf("Status code not 200: was %d", r.StatusCode)
  64. }
  65. if err != nil {
  66. t.Error(err)
  67. }
  68. }