feat(ads/seo/release): v1.2.0 with live Google Ads, isolated ad profile, ads.txt, and SEO/AEO/GEO optimization
This commit is contained in:
parent
a88aafa1e5
commit
0e568f1f0a
975 changed files with 130593 additions and 16783 deletions
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Paca.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 적응형 청크 크기 조절, 체크섬 무결성, 발열 스로틀링, 트랜스코딩 프로파일 및 스트리밍 프록시 게이트 (Gate 131 ~ Gate 135)
|
||||
/// </summary>
|
||||
public class AdaptiveStreamingAndIntegrityGateTests
|
||||
{
|
||||
[Fact]
|
||||
public void Gate131_AdaptiveChunkSizingEngine_Audit()
|
||||
{
|
||||
var engine = new AdaptiveChunkSizingEngine();
|
||||
|
||||
// 60 Mbps (초고속망) -> 8MB 청크
|
||||
Assert.Equal(8 * 1024 * 1024, engine.CalculateOptimalChunkSize(measuredSpeedKbps: 60 * 1024));
|
||||
|
||||
// 20 Mbps (표준망) -> 4MB 청크
|
||||
Assert.Equal(4 * 1024 * 1024, engine.CalculateOptimalChunkSize(measuredSpeedKbps: 20 * 1024));
|
||||
|
||||
// 5 Mbps (저속망) -> 1MB 청크
|
||||
Assert.Equal(1 * 1024 * 1024, engine.CalculateOptimalChunkSize(measuredSpeedKbps: 5 * 1024));
|
||||
|
||||
// 500 Kbps (극저속망) -> 512KB 청크
|
||||
Assert.Equal(512 * 1024, engine.CalculateOptimalChunkSize(measuredSpeedKbps: 500));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate132_MediaChecksumValidator_Sha256_Audit()
|
||||
{
|
||||
var validator = new MediaChecksumValidator();
|
||||
var sampleBytes = Encoding.UTF8.GetBytes("Paca Secure Media Download Engine 2026");
|
||||
|
||||
// 기대되는 SHA-256 해시 계산
|
||||
using var sha = SHA256.Create();
|
||||
var expectedHash = Convert.ToHexString(sha.ComputeHash(sampleBytes)).ToLowerInvariant();
|
||||
|
||||
Assert.True(validator.VerifySha256(sampleBytes, expectedHash));
|
||||
Assert.False(validator.VerifySha256(sampleBytes, "invalid_hash_string"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate133_ThermalThrottlingGuard_Audit()
|
||||
{
|
||||
var guard = new ThermalThrottlingGuard();
|
||||
Assert.Equal(42.0, guard.OverheatThresholdCelsius);
|
||||
Assert.Equal(38.0, guard.NormalRecoveryThresholdCelsius);
|
||||
|
||||
// 35°C 정상 -> 스로틀링 비활성, 6세그먼트
|
||||
Assert.False(guard.IsThrottled(currentTemperatureCelsius: 35.0));
|
||||
Assert.Equal(6, guard.GetAdjustedSegments(requestedSegments: 6, currentTemperatureCelsius: 35.0));
|
||||
|
||||
// 43°C 과열 -> 스로틀링 활성, 1세그먼트로 강제 감속
|
||||
Assert.True(guard.IsThrottled(currentTemperatureCelsius: 43.0));
|
||||
Assert.Equal(1, guard.GetAdjustedSegments(requestedSegments: 6, currentTemperatureCelsius: 43.0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate134_TranscodeProfileManager_Profiles_Audit()
|
||||
{
|
||||
var manager = new TranscodeProfileManager();
|
||||
|
||||
var mp4Args = manager.GetFfmpegProfileArgs("mp4_universal");
|
||||
Assert.Contains("-c:v libx264", mp4Args);
|
||||
Assert.Contains("-c:a aac", mp4Args);
|
||||
|
||||
var webmArgs = manager.GetFfmpegProfileArgs("webm_modern");
|
||||
Assert.Contains("-c:v libvpx-vp9", webmArgs);
|
||||
Assert.Contains("-c:a libopus", webmArgs);
|
||||
|
||||
var mp3Args = manager.GetFfmpegProfileArgs("audio_mp3_hq");
|
||||
Assert.Contains("-vn", mp3Args);
|
||||
Assert.Contains("-b:a 320k", mp3Args);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate135_RemoteStreamProxyBuffer_RingBuffer_Audit()
|
||||
{
|
||||
var buffer = new RemoteStreamProxyBuffer(capacityBytes: 1024);
|
||||
Assert.Equal(0, buffer.BufferedBytes);
|
||||
|
||||
var chunk1 = new byte[256];
|
||||
Array.Fill(chunk1, (byte)0xAA);
|
||||
buffer.Write(chunk1);
|
||||
Assert.Equal(256, buffer.BufferedBytes);
|
||||
|
||||
var readTarget = new byte[128];
|
||||
var readCount = buffer.Read(readTarget, 0, 128);
|
||||
Assert.Equal(128, readCount);
|
||||
Assert.Equal(128, buffer.BufferedBytes);
|
||||
Assert.Equal(0xAA, readTarget[0]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue